On 31.01.2007, at 22:21, William Morgan wrote:

>> In the app I'm writing, we convert the score to a percentage and
>> display it with the search results.
>
> How are you converting scores to percentages? I.e. what are you  
> using as
> the maximum value?

Ferret::Search::TopDocs#max_score

Example:

   index = Ferret::I.new

   index << "tic"
   index << "tic tac"
   index << "tic tac toe"

   docs = index.search("tic OR tac")

   docs.hits.each { |hit| puts hit.score / docs.max_score * 100 }

Result:

100.0
79.999993785928
26.9283741206894

Cheers,
Andy
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to