benwtrent commented on code in PR #12314:
URL: https://github.com/apache/lucene/pull/12314#discussion_r1243611229


##########
lucene/core/src/java/org/apache/lucene/search/VectorScorer.java:
##########
@@ -85,6 +96,26 @@ public boolean advanceExact(int doc) throws IOException {
       return vectorDoc == doc;
     }
 
+    @Override
+    public Map<Integer, Float> scoreMultiValued(BitSet acceptedDocs) throws 
IOException {
+      Map<Integer, Float> docToScore = new HashMap<>();
+      for (int vectorId = values.nextDoc(); vectorId != NO_MORE_DOCS; vectorId 
= values.nextDoc()) {
+        int docID = values.ordToDoc(vectorId);
+        if (acceptedDocs.get(docID)) {
+          float currentScore = similarity.compare(query, values.vectorValue());
+          docToScore.putIfAbsent(docID, currentScore);
+          docToScore.computeIfPresent(docID,
+                  (key, previousScore) -> Math.max(previousScore, 
currentScore));
+        }
+      }
+      return docToScore;
+    }

Review Comment:
   I don't see how we can do this here. Instead of randomly iterating the 
BitSet and going to the exact document, we are iterating every vector in the 
scorer and checking its membership in `acceptedDocs`. 
   
   Even multi-valued `*VectorValues` classes need to be able to iterate to the 
exact document. Otherwise searching with a filter like this is untenable.



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