mayya-sharipova commented on code in PR #12794:
URL: https://github.com/apache/lucene/pull/12794#discussion_r1403563168


##########
lucene/core/src/java/org/apache/lucene/search/TopKnnCollector.java:
##########
@@ -26,26 +26,71 @@
  * @lucene.experimental
  */
 public final class TopKnnCollector extends AbstractKnnCollector {
+  private static final float DEFAULT_GREEDINESS = 0.9f;
 
   private final NeighborQueue queue;
+  private final float greediness;
+  private final NeighborQueue queueg;
+  private final MaxScoreAccumulator globalMinSimAcc;
+  private boolean kResultsCollected = false;
+  private float cachedGlobalMinSim = Float.NEGATIVE_INFINITY;
+
+  // greediness of globally non-competitive search: [0,1]
 
   /**
    * @param k the number of neighbors to collect
    * @param visitLimit how many vector nodes the results are allowed to visit
+   * @param globalMinSimAcc the global minimum competitive similarity tracked 
across all segments
    */
-  public TopKnnCollector(int k, int visitLimit) {
+  public TopKnnCollector(int k, int visitLimit, MaxScoreAccumulator 
globalMinSimAcc) {
+    super(k, visitLimit);
+    this.greediness = DEFAULT_GREEDINESS;
+    this.queue = new NeighborQueue(k, false);
+    int queuegSize = Math.max(1, Math.round((1 - greediness) * k));
+    this.queueg = new NeighborQueue(queuegSize, false);

Review Comment:
   Indeed, it is local.



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