SOLR-17813: Add support for SeededKnnVectorQuery in vector search#3705
Merged
alessandrobenedetti merged 19 commits intoapache:mainfrom Oct 20, 2025
Merged
SOLR-17813: Add support for SeededKnnVectorQuery in vector search#3705alessandrobenedetti merged 19 commits intoapache:mainfrom
alessandrobenedetti merged 19 commits intoapache:mainfrom
Conversation
# Conflicts: # solr/CHANGES.txt # solr/core/src/java/org/apache/solr/schema/DenseVectorField.java # solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java # solr/core/src/test/org/apache/solr/search/neural/KnnQParserTest.java # solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
cpoerschke
reviewed
Sep 26, 2025
solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java
Outdated
Show resolved
Hide resolved
ilariapet
commented
Oct 3, 2025
solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java
Outdated
Show resolved
Hide resolved
alessandrobenedetti
approved these changes
Oct 3, 2025
Contributor
alessandrobenedetti
left a comment
There was a problem hiding this comment.
Just reviewed in details, some minors Ila is going to solve, the PR is approved!
0eef2d7 to
ff9ef88
Compare
ff9ef88 to
07b6427
Compare
cpoerschke
reviewed
Oct 17, 2025
cpoerschke
reviewed
Oct 17, 2025
solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc
Outdated
Show resolved
Hide resolved
alessandrobenedetti
pushed a commit
that referenced
this pull request
Oct 20, 2025
) * support Lucene's (proposed) HNSW search seeding feature Co-authored-by: Christine Poerschke <cpoerschke@apache.org> (cherry picked from commit 4f17dee)
alessandrobenedetti
pushed a commit
that referenced
this pull request
Oct 21, 2025
) * support Lucene's (proposed) HNSW search seeding feature Co-authored-by: Christine Poerschke <cpoerschke@apache.org> (cherry picked from commit 4f17dee)
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-17813
Description
Apache Lucene implemented a version of knn vector query called SeededKnnVectorQuery that provides a query seed to initiate the vector search (entry points in the HNSW graph exploration) based on Lexically-Accelerated Dense Retrieval
Solution
This PR introduces a new optional parameter for the current KNN query parser:
seedQuery.The seed parameter can be any valid Solr query, allowing traditional query logic to guide the vector search in a hybrid-like way.
Added a new method
getSeedQuery()that parses the seed parameter and returns the corresponding Lucene Query.When a seed query is present, the KNN vector query is wrapped with SeededKnnVectorQuery:
SeededKnnVectorQuery.fromFloatQuery(...) for FLOAT32 vectors.
SeededKnnVectorQuery.fromByteQuery(...) for BYTE vectors.
If no seedQuery is provided, the parser behaves as before and executes a "standard" KNN query.
Tests
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.