ChrisHegarty commented on code in PR #14963:
URL: https://github.com/apache/lucene/pull/14963#discussion_r2447089215
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsReader.java:
##########
@@ -332,18 +332,18 @@ private void search(
final RandomVectorScorer scorer = scorerSupplier.get();
final KnnCollector collector =
new OrdinalTranslatedKnnCollector(knnCollector, scorer::ordToDoc);
- HnswGraph graph = getGraph(fieldEntry);
// Take into account if quantized? E.g. some scorer cost?
// Use approximate cardinality as this is good enough, but ensure we don't
exceed the graph
// size as that is illogical
+ HnswGraph graph = getGraph(fieldEntry);
int filteredDocCount = Math.min(acceptDocs.cost(), graph.size());
Bits accepted = acceptDocs.bits();
final Bits acceptedOrds = scorer.getAcceptOrds(accepted);
int numVectors = scorer.maxOrd();
boolean doHnsw = knnCollector.k() < numVectors;
// The approximate number of vectors that would be visited if we did not
filter
int unfilteredVisit =
HnswGraphSearcher.expectedVisitedNodes(knnCollector.k(), graph.size());
- if (unfilteredVisit >= filteredDocCount) {
+ if (unfilteredVisit >= filteredDocCount || graph.size() == 0) {
Review Comment:
++
--
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]