Jens Kraemer wrote:
> On Thu, Aug 23, 2007 at 11:51:42PM +0200, Sam Giffney wrote:
>> Raymond O'Connor wrote:
>> > Right now, I'm just sorting by the popularity column in my search
>> > results, although this doesn't always provide "good" results, neither
>> > does just sorting by document relevance.  I'd like some combination of
>> > the two to sort by.  Is it possible to do this efficiently with ferret?
>> 
>> Another option, although requiring a bit more work for the index, would 
>> be to boost each product by a dynamic value (appropriate to a normalised 
>> popularity perhaps) at index build time. Then you could just search and 
>> popularity would automatically be utilised.
> 
> cool, didn't think of this - sounds better to me than constructing the
> complex queries I suggested :-)

Cool. Just today I was looking for a solution like this :-)

When implementing I stumbled upon a problem indexing with
script/runner Mymodel.rebuild_index

class Mymodel < ActiveRecord::Base
  acts_as_ferret  :fields => {:name => {:boost => :rating}}

  # function for determining boost value
  def rating
     return instance_rating
  end
end

This exits with

./script/../config/../vendor/rails/railties/lib/commands/runner.rb:47: 
./script/
../config/../vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:136:in 
`add_fie
ld': can't convert Symbol into Float (TypeError)

Using the function name instead of the :symbol doesn't work either

./script/../config/../vendor/rails/railties/lib/commands/runner.rb:47: 
undefined
 method `rating' for Place:Class (NoMethodError)
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to