Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the maximum value of a lucene score?

Tags:

java

lucene

I am thinking about the default scoring function for which StandardAnalyzer has been used.

It seems the value is sometimes above 1.0.

like image 232
user3111525 Avatar asked Dec 06 '22 17:12

user3111525


1 Answers

There isn't really a maximum score.

When Lucene does it's scoring, it basically sums a set of scores together to give a total score.

For example:

Suppose I search for A OR B. This query is broken into its constituent parts - A and B. Each part of this query is searched independently using a sub-scorer and given score for the relevant part of the query. If a document contains both A and B, the score will be a combination of scores from both sub-scorers.

Because there can be many sub-scorers, the total score can be greater than 1.

The score of a particular hit is absolute, meaning that it can only be used as a comparison to the highest score from the same search. Scores across different searches are not directly comparable.

If you really do need a value between 0 and 1, you can normalise each score based on the ratio of its value to the highest score from the search. This will give you the equivalent of a percentage score. These percentages still cannot be compared across searches though.

More info can be found here and here.

like image 78
adrianbanks Avatar answered Dec 09 '22 07:12

adrianbanks