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/09/02 20:00:08 UTC

[GitHub] [lucene] msokolov commented on a change in pull request #278: LUCENE-10063 Correct BaseKnnVectorsFormatTestCase.randomWithUpdatesAndGraph

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