Stephen Hendry
Stephen Hendry

Reputation: 751

Lucene Score results

In Lucene if you had multiple indexes that covered only one partition each. Why does the same search on different indexes return results with different scores? The results from different servers match exactly.

i.e. if I searched for :

Partition 0 would return a score of 0.345

Partition 1 would return a score of 0.337

Both match exactly on name and DOB.

Upvotes: 46

Views: 4107

Answers (3)

Michael Stum
Michael Stum

Reputation: 180884

Because the score is determined on the index if I am not completely mistaken.

If you have different indexes (more/less or different data that was indexed), the score will differ:

http://lucene.apache.org/core/3_6_0/scoring.html

(Warning: Contains Math :-))

Upvotes: 13

Joe Shaw
Joe Shaw

Reputation: 22592

You may also be interested in the output of the explain() method, and the resulting Explanation object, which will give you an idea of how things are scored the way they are.

Upvotes: 9

Stephen Hendry
Stephen Hendry

Reputation: 751

The scoring contains the Inverse Document Frequency(IDF). If the term "John Smith" is in one partition, 0, 100 times and in partition 1, once. The score for searching for John Smith would be higher search in partition 1 as the term is more scarce.

To get round this you would wither have to have your index being over all partitions, or you would need to override the IDF.

Upvotes: 20

Related Questions