mayya-sharipova commented on a change in pull request #1937:
URL: https://github.com/apache/lucene-solr/pull/1937#discussion_r498851410



##########
File path: lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java
##########
@@ -140,6 +141,13 @@ private static void addTwoPhaseIterator(TwoPhaseIterator 
twoPhaseIter, List<DocI
   private static DocIdSetIterator createConjunction(
       List<DocIdSetIterator> allIterators,
       List<TwoPhaseIterator> twoPhaseIterators) {
+
+    // assert that all sub-iterators are on the same doc ID
+    int curDoc = allIterators.size() > 0 ? allIterators.get(0).docID() : 
twoPhaseIterators.get(0).approximation.docID();
+    boolean iteratorsOnTheSameDoc = allIterators.stream().allMatch(it -> 
it.docID() == curDoc);
+    iteratorsOnTheSameDoc = iteratorsOnTheSameDoc && 
twoPhaseIterators.stream().allMatch(it -> it.approximation().docID() == curDoc);
+    assert iteratorsOnTheSameDoc : "Sub-iterators of ConjunctionDISI are not 
the same document!";

Review comment:
       addressed in 74151e3

##########
File path: lucene/core/src/java/org/apache/lucene/search/ConjunctionDISI.java
##########
@@ -227,6 +236,7 @@ private int doNext(int doc) throws IOException {
 
   @Override
   public int advance(int target) throws IOException {
+    assertItersOnSameDoc();

Review comment:
       addressed in 74151e3




----------------------------------------------------------------
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:
us...@infra.apache.org



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

Reply via email to