jpountz commented on code in PR #833:
URL: https://github.com/apache/lucene/pull/833#discussion_r857318802


##########
lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java:
##########
@@ -323,6 +325,35 @@ public int nextDoc() throws IOException {
           : sortedSetDocValues;
     }
 
+    @Override
+    public VectorValues getVectorValues(String field) throws IOException {
+      final VectorValues vectorValues = in.getVectorValues(field);
+      if (vectorValues == null) {
+        return null;
+      }
+      return (queryTimeout.isTimeoutEnabled())
+          ? new ExitableVectorValues(vectorValues)
+          : vectorValues;
+    }
+
+    @Override
+    public TopDocs searchNearestVectors(
+        String field, float[] target, int k, Bits acceptDocs, int 
visitedLimit) throws IOException {
+      // nocommit - sampling needed?
+      if (queryTimeout.shouldExit()) {
+        throw new ExitingReaderException(
+            "The request took too long to search nearest vectors. Timeout: "
+                + queryTimeout.toString()
+                + ", Reader="
+                + in);
+      } else if (Thread.interrupted()) {
+        throw new ExitingReaderException(
+            "Interrupted while searching nearest vectors. Reader=" + in);
+      }
+
+      return in.searchNearestVectors(field, target, k, acceptDocs, 
visitedLimit);

Review Comment:
   Maybe we should wrap `acceptDocs` and check the query timeout on every N 
calls to `Bits#get`?



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