You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/11/08 21:08:25 UTC

[GitHub] [lucene] msokolov commented on a change in pull request #431: LUCENE-10208: Ensure that the minimum competitive score does not decrease in concurrent search

msokolov commented on a change in pull request #431:
URL: https://github.com/apache/lucene/pull/431#discussion_r745092082



##########
File path: lucene/core/src/java/org/apache/lucene/search/MaxScoreAccumulator.java
##########
@@ -35,9 +35,22 @@
     this.modInterval = DEFAULT_INTERVAL;
   }
 
-  void accumulate(int docID, float score) {
-    assert docID >= 0 && score >= 0;
-    long encode = (((long) Float.floatToIntBits(score)) << 32) | docID;
+  private static long maxBinary(long v1, long v2) {
+    float score1 = Float.intBitsToFloat((int) (v1 >> 32));
+    float score2 = Float.intBitsToFloat((int) (v2 >> 32));
+    int cmp = Float.compare(score1, score2);
+    if (cmp == 0) {
+      // tie-break on the minimum doc base
+      return (int) v1 < (int) v2 ? v1 : v2;

Review comment:
       the problem is we want decreasing scores and increasing docIDs? -- but previously we combined the comparison so we would get decreasing docIDs?

##########
File path: lucene/core/src/java/org/apache/lucene/search/MaxScoreAccumulator.java
##########
@@ -47,24 +60,25 @@ DocAndScore get() {
       return null;
     }
     float score = Float.intBitsToFloat((int) (value >> 32));
-    int docID = (int) value;
-    return new DocAndScore(docID, score);
+    int docBase = (int) value;
+    return new DocAndScore(docBase, score);
   }
 
   static class DocAndScore implements Comparable<DocAndScore> {
-    final int docID;
+    final int docBase;

Review comment:
       just curious why the name change to docBase? Oh I see below in the caller it makes sense




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org