Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Commit

Permalink
Use the global doc id to generate a random score (elastic#33599)
Browse files Browse the repository at this point in the history
This commit changes the random_score function to use the global docID of the document
rather than the segment docID to generate random scores. As a result documents that have
the same segment docID within the shard will generate different scores.
  • Loading branch information
jimczi authored Sep 19, 2018
1 parent c4261ba commit 61e1df0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public LeafScoreFunction getLeafScoreFunction(LeafReaderContext ctx) {
public double score(int docId, float subQueryScore) throws IOException {
int hash;
if (values == null) {
hash = BitMixer.mix(docId, saltedSeed);
hash = BitMixer.mix(ctx.docBase + docId, saltedSeed);
} else if (values.advanceExact(docId)) {
hash = StringHelper.murmurhash3_x86_32(values.nextValue(), saltedSeed);
} else {
Expand Down

0 comments on commit 61e1df0

Please sign in to comment.