dweiss commented on a change in pull request #141:
URL: https://github.com/apache/lucene/pull/141#discussion_r633528657



##########
File path: lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java
##########
@@ -138,7 +141,7 @@ public T insertWithOverflow(T element) {
     if (size < maxSize) {
       add(element);
       return null;
-    } else if (size > 0 && !lessThan(element, heap[1])) {

Review comment:
       This is the core of the change that makes pq object selection "stable".

##########
File path: lucene/core/src/test/org/apache/lucene/util/TestPriorityQueue.java
##########
@@ -47,6 +49,50 @@ protected final void checkValidity() {
     }
   }
 
+  public void testZeroSizedQueue() {

Review comment:
       And this is a demonstration of why zero-sized PQ exhibits invalid 
behavior.




-- 
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.

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