SOLR-18267: Add scalar quantized flat vector index support with no HNSW - #4698
Open
adamjq wants to merge 1 commit into
Open
SOLR-18267: Add scalar quantized flat vector index support with no HNSW#4698adamjq wants to merge 1 commit into
adamjq wants to merge 1 commit into
Conversation
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.
https://issues.apache.org/jira/browse/SOLR-18267
Description
This PR follows up from #4492, which added a new
knnAlgorithm=flatoption toDenseVectorField. It adds the same flat index support toScalarQuantizedDenseVectorFieldso that scalar-quantized fields can also be indexed without building HNSW graphs.The new behavior introduced is:
ScalarQuantizedDenseVectorFieldnow supportsknnAlgorithm=flat. Searching works through the{!knn},{!knn_text_to_vector}, and{!vectorSimilarity}query parsers, and thevectorSimilarity()function query.ScalarQuantizedDenseVectorFieldwithknnAlgorithm=flatandvectorEncoding=BYTEis rejected explicitlyNote:
knnAlgorithm=flatis not supported forBinaryQuantizedDenseVectorFieldSolution
This PR adds support for
ScalarQuantizedDenseVectorFieldwithknnAlgorithm=flatby delegating to Lucene104ScalarQuantizedVectorsFormat.This implementation differs from #4492 in two main ways:
Lucene104ScalarQuantizedVectorsFormatimplements brute-force KNN search, meaning theknn,knn_text_to_vectorandvectorSimilarityquery parsers are supported by defaultLucene104ScalarQuantizedVectorsFormatis registered in SPI, so no wrapper class is neededThe table below shows the different segment files generated between the flat vs HNSW configurations:
.vec.vemf.veq.vemq.vem.vexAI Disclosure: Claude was used to assist with this PR. All code has been reviewed and tested by me.
Tests
Unit tests for ScalarQuantizedDenseVectorField.
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.