Repository navigation
Add Float16VectorSimilarityQuery for similarity threshold search over fp16 vectors - #16735
Merged
Merged
Conversation
2 of 5 tasks
Contributor
Author
|
The failing arm CI job is in |
kaivalnp
approved these changes
Sep 28, 2026
Contributor
There was a problem hiding this comment.
LGTM, thanks!
Edit: I will merge this in a day, unless there are further comments. The test failure does seem unrelated, I opened #16736. The same test failed on a re-run, either we got really (un)lucky or the failure is very common.
Pulkitg64
approved these changes
Sep 29, 2026
2 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of #16725. Adds
Float16VectorSimilarityQuery, the fp16 counterpart ofFloatVectorSimilarityQuery/ByteVectorSimilarityQuery, so similaritythreshold search works on fields indexed with
KnnFloat16VectorField.The class mirrors
FloatVectorSimilarityQueryon top of the fp16 APIs added in#16383 (
Float16VectorValues,LeafReader#getFloat16VectorValues, theshort[]searchNearestVectorsoverload,VectorUtil#checkFiniteFloat16).toStringconverts the first target component withFloat.float16ToFloatsoit prints a readable value rather than the raw bits.
One deliberate difference: only the
Adaptivevariant is provided. In thefloat and byte queries,
Explicitis@Deprecatedand exists to stayequivalent to the Lucene 10.4 constructors; fp16 has no such legacy callers, so
adding a new API that is deprecated from day one didn't seem useful. The class
keeps the same
sealedshape, soExplicitcan be added later if reviewersprefer parity.
Tests
TestFloat16VectorSimilarityQueryplugs fp16 types into the sharedBaseVectorSimilarityQueryTestCase. Ran it with-Ptests.iters=20, and with-Dtests.monster=truesotestApproximatealso exercises the HNSW path; allpass.
tidyandecjLintare clean.