ChrisHegarty commented on code in PR #13355:
URL: https://github.com/apache/lucene/pull/13355#discussion_r1596969665
##########
lucene/core/src/java/org/apache/lucene/codecs/hnsw/DefaultFlatVectorScorer.java:
##########
@@ -101,7 +102,9 @@ private ByteScoringSupplier(
@Override
public RandomVectorScorer scorer(int ord) throws IOException {
- return new ByteVectorScorer(vectors2, vectors1.vectorValue(ord),
similarityFunction);
+ byte[] ba = vectors1.vectorValue(ord);
+ return new ByteVectorScorer(
+ vectors2, ArrayUtil.copyOfSubArray(ba, 0, ba.length),
similarityFunction);
Review Comment:
Good catch. The prior implementation stored the ord rather than the vector
bytes. We should do the same here, which will avoid the copy. The scorers (not
the supplier), do not suffer a similar issue, since their API doe not allow to
score against anything other than the first vector.
--
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]