Multi_score?

Hi!

I’m using acts_as_ferret in my rails project and i need to order the
search results by a combination of the result given by ferret (score)
and a ranking in the database (normalized also). this combination can be
like that:

0.4ferret_score+0.6database_score

this database_score is also indexed
any idea?

and someone know how to access the ferret data in the object returned by
find_by_content in aaf?

thanks in advance!
José Valim.

On Fri, Sep 21, 2007 at 03:44:24AM +0200, José Valim wrote:

any idea?
Probably the easiest way to achieve this is to use your ranking as a
document specific boost (available in current trunk):

acts_as_ferret :fields => { … }, :boost => :normalized_ranking

That way your ranking will directly affect the score Ferret calculates.
Useful values for boosts in the index are 0…255, you’ll have to
experiment a bit to see what boosts work best for you.

and someone know how to access the ferret data in the object returned by
find_by_content in aaf?

what do you mean by ferret data? You may access the score Ferret
assigned to a specific result with the ferret_score method.

cheers,
Jens


Jens Krämer
http://www.jkraemer.net/ - Blog
http://www.omdb.org/ - The new free film database

what do you mean by ferret data?
My aaf is like that:

acts_as_ferret :fields => {
:title => {:boost => 3},
:url => {:boost => 1},
:content => {:boost => 2, :stored =>
true},
:keywords => {:boost => 0}
}, :remote => true # use ferret_server specified in

Only content is not an ActiveRecord attribute, it’s a method.
So, when i get the results of ferret and do:

results.each |result| do
result.content
end

It brings me nothing. I wish I could access the ‘content’ which is in
ferret index.

Thanks Jens for you reply.

Oh, i’ve found why i can’t get the fields.
I should use the key :store => :yes
And not :store => true.