ChrisHegarty commented on code in PR #14963:
URL: https://github.com/apache/lucene/pull/14963#discussion_r2379236398
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsReader.java:
##########
@@ -326,16 +335,16 @@ private void search(
final KnnCollector collector =
new OrdinalTranslatedKnnCollector(knnCollector, scorer::ordToDoc);
final Bits acceptedOrds = scorer.getAcceptOrds(acceptDocs);
- HnswGraph graph = getGraph(fieldEntry);
- boolean doHnsw = knnCollector.k() < scorer.maxOrd();
+ boolean doHnsw = knnCollector.k() < scorer.maxOrd() &&
fieldEntry.vectorIndexLength > 0;
// Take into account if quantized? E.g. some scorer cost?
int filteredDocCount = 0;
// The approximate number of vectors that would be visited if we did not
filter
- int unfilteredVisit =
HnswGraphSearcher.expectedVisitedNodes(knnCollector.k(), graph.size());
+ int unfilteredVisit =
+ HnswGraphSearcher.expectedVisitedNodes(knnCollector.k(),
fieldEntry.size());
Review Comment:
This is a necessary change. I think that this is correct, but someone should
verify that graph.size was not actually explicitly intended here. Or if it
should be fieldEntry.size if graph.size is 0 (EMPTY)
--
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]