apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.45k stars 973 forks source link

Fix default flat vector scorer supplier sharing backing array #13355

Closed ChrisHegarty closed 1 month ago

ChrisHegarty commented 1 month ago

This commit fixes an issue in the default flat vector scorer supplier whereby subsequent scorers created by the supplier can affect previously created scorers.

The issue is that we're sharing the backing array from the vector values, and overwriting it in subsequent scorers. We just need to use the ordinal to protect the scorer instance from mutation.

The test is a little verbose, but duplicates the issue and is extended in another PR to cover more flat vector scorer implementations.