SOLR-17814: Add support for PatienceKnnVectorQuery#3644
Merged
alessandrobenedetti merged 6 commits intoapache:mainfrom Sep 23, 2025
Merged
SOLR-17814: Add support for PatienceKnnVectorQuery#3644alessandrobenedetti merged 6 commits intoapache:mainfrom
alessandrobenedetti merged 6 commits intoapache:mainfrom
Conversation
ilariapet
commented
Sep 10, 2025
solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java
Outdated
Show resolved
Hide resolved
ilariapet
commented
Sep 10, 2025
solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java
Outdated
Show resolved
Hide resolved
ilariapet
commented
Sep 10, 2025
solr/core/src/java/org/apache/solr/search/neural/KnnQParser.java
Outdated
Show resolved
Hide resolved
ilariapet
commented
Sep 10, 2025
solr/core/src/test/org/apache/solr/search/neural/KnnQParserTest.java
Outdated
Show resolved
Hide resolved
ilariapet
commented
Sep 10, 2025
solr/core/src/test/org/apache/solr/search/neural/KnnQParserTest.java
Outdated
Show resolved
Hide resolved
ilariapet
commented
Sep 10, 2025
solr/core/src/test/org/apache/solr/search/neural/KnnQParserTest.java
Outdated
Show resolved
Hide resolved
ilariapet
commented
Sep 10, 2025
solr/core/src/test/org/apache/solr/search/neural/KnnQParserTest.java
Outdated
Show resolved
Hide resolved
d4afa1b to
f22e59b
Compare
f22e59b to
d044ae5
Compare
alessandrobenedetti
approved these changes
Sep 23, 2025
Contributor
alessandrobenedetti
left a comment
There was a problem hiding this comment.
Various iterations of reviews completed, ready to merge
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-17814
Description
Apache Lucene implements an early termination approach for knn queries:
org.apache.lucene.search.PatienceKnnVectorQuery
This is a version of knn vector query that exits early when HNSW queue saturates over a
saturationThresholdfor more thanpatiencetimes.Solution
A new query type, PatienceKnnVectorQuery, was introduced, exposed through the KnnQParser with three additional parameters:
earlyTermination(boolean, default: false) – enables early termination during the search.saturationThreshold(double) – controls the saturation level for early termination.patience(int) – configures the patience factor for the termination strategy.This allows users to decide whether or not to run the vector query with early termination. They can either rely on the default values provided by Lucene or override both of them with custom values.
Since the
TextToVectorQParserextends the same base class, these parameters are also automatically available there, allowing the same early termination functionality without additional changes.Tests
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.