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



##########
File path: 
lucene/test-framework/src/java/org/apache/lucene/index/BaseKnnVectorsFormatTestCase.java
##########
@@ -853,16 +854,25 @@ public void testRandomWithUpdatesAndGraph() throws 
Exception {
                   id2value[id],
                   v,
                   0);
+              numLiveDocsWithVectors++;
             } else {
               if (id2value[id] != null) {
                 assertFalse(Arrays.equals(id2value[id], v));
               }
             }
           }
-          // assert that searchNearestVectors returns the expected number of 
documents, in
-          // descending score order
+
+          if (numLiveDocsWithVectors == 0) {
+            continue;
+          }
+
+          // assert that searchNearestVectors returns the expected number of 
documents,
+          // in descending score order
           int size = ctx.reader().getVectorValues(fieldName).size();
-          int k = random().nextInt(size / 2 + 1);
+          int k = random().nextInt(size / 2 + 1) + 1;

Review comment:
       hm yeah I had intended to put that +1 outside the parentheses - in my 
mind?




-- 
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-unsubscr...@lucene.apache.org

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