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