msokolov commented on code in PR #12434:
URL: https://github.com/apache/lucene/pull/12434#discussion_r1279451735


##########
lucene/core/src/java/org/apache/lucene/search/KnnCollector.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.search;
+
+/**
+ * KnnCollector is a knn collector used for gathering kNN results and 
providing topDocs from the
+ * gathered neighbors
+ *
+ * @lucene.experimental
+ */
+public interface KnnCollector {
+
+  /**
+   * If search visits too many documents, the results collector will terminate 
early. Usually, this
+   * is due to some restricted filter on the document set.
+   *
+   * <p>When collection is earlyTerminated, the results are not a correct 
representation of k
+   * nearest neighbors.
+   *
+   * @return is the current result set marked as incomplete?
+   */
+  boolean earlyTerminated();
+
+  /**
+   * @param count increments the visited vector count, must be greater than 0.
+   */
+  void incVisitedCount(int count);
+
+  /**
+   * @return the current visited vector count
+   */
+  long visitedCount();
+
+  /**
+   * @return the visited vector limit
+   */
+  long visitLimit();
+
+  /**
+   * @return the expected number of collected results
+   */
+  int k();
+
+  /**
+   * Collect the provided docId and include in the result set.

Review Comment:
   I think the implementation is fine; it's just the javadoc that bothers me, 
because KnnCollectors (such as OrdinalTranslatedKnnCollector) may be passed 
vectorIds. But if that's really the only one, and it's internal, then I guess 
this is fine :)



-- 
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: [email protected]

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