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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to