Forum: Ferret Exact phrase score

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
EJ Finneran (Guest)
on 2007-01-23 06:15
Sorry if this has been beaten to death here but I couldn't find the
exact answer I was looking for.

In the app I'm writing, we convert the score to a percentage and display
it with the search results.  The problem is when you search for an exact
phrase (for example) and it matches the title of a document exactly, you
only get a 17% match.

Has anyone seen a way to either curve the scores or make an exact phrase
match get a higher score?

I've looked over the similarity formula so I'm pretty sure I understand
why it happens but I'm just looking for ways to counteract it/make the
score make more sense to the user.


Thanks,
removed_email_address@domain.invalid
William M. (Guest)
on 2007-01-31 23:28
(Received via mailing list)
Excerpts from EJ Finneran's message of Mon Jan 22 20:15:08 -0800 2007:
> In the app I'm writing, we convert the score to a percentage and
> display it with the search results.  The problem is when you search
> for an exact phrase (for example) and it matches the title of a
> document exactly, you only get a 17% match.
>
> Has anyone seen a way to either curve the scores or make an exact
> phrase match get a higher score?

How are you converting scores to percentages? I.e. what are you using as
the maximum value?

Are you looking for percentages that are consistent across queries, or
just across results in a single query?
Andreas K. (Guest)
on 2007-02-01 00:20
(Received via mailing list)
On 31.01.2007, at 22:21, William M. 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
This topic is locked and can not be replied to.