How to make a Tag cloud with Ferret?

Hello,

I want to make a TAG CLOUD using ferret.
How can i do so ?

I would need to know the amount of keyword for every each words in the
index.

Thank you

Hello,

See TermEnum documentation:

http://ferret.davebalmain.com/api/classes/Ferret/Index/TermEnum.html

John.

On Mon, 2007-05-14 at 17:17 +0200, py landanger wrote:


http://johnleach.co.uk

Thank you John ^^

Hey John…

well, thats a tough question, esp. as there is no ‘general rule’ on
how a tag could should
look like and which criteria should be taken into account…

http://www.omdb.org/encyclopedia

is based on ferret… but we’re storing a :popularity for each tag…
and ferret is simply
sorting its index using the popularity …

here’s what we do [1]:

def popular_categories_by_type( root_id )
query = BooleanQuery.new
query.add_query( TermQuery.new( :type,
Category.to_s.downcase ), :must )
query.add_query( TermQuery.new( :root_id, root_id.to_s ), :must )
query.add_query( TermQuery.new( :is_assignable, ‘1’ ), :must )
order = orderfield( [ “popularity”.to_sym ], :type
=> :integer, :reverse => true )
objects = self.real_search( query, :limit => 30, :order => order )
end

hope that helps …

Ben

[1] http://bugs.omdb.org/browser/trunk/lib/omdb/ferret/local_search.rb

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs