-
Notifications
You must be signed in to change notification settings - Fork 1.3k
knn search - add tests to perform exact search when filtering does not return enough results #14274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
knn search - add tests to perform exact search when filtering does not return enough results #14274
Conversation
…esults pass the filter, execute exact search
# Conflicts: # lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java # lucene/core/src/test/org/apache/lucene/search/TestKnnByteVectorQuery.java # lucene/core/src/test/org/apache/lucene/search/TestKnnFloatVectorQuery.java
| import org.apache.lucene.index.Term; | ||
| import org.apache.lucene.index.VectorEncoding; | ||
| import org.apache.lucene.index.VectorSimilarityFunction; | ||
| import org.apache.lucene.index.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not transform to * here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, fixed! 😊
|
@benwtrent a review is much appreciated. Thanks! |
lucene/core/src/test/org/apache/lucene/search/BaseKnnVectorQueryTestCase.java
Show resolved
Hide resolved
benwtrent
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good additional coverage. I will merge and backport once CI is happy :)
…t return enough results (#14274) When doing approximate knn search, it's possible that the approximate search returns less than k results. In case there is a filter, we know the filter cost so we can check if there are actually more than k results that match the filter. In that case, we can switch to exact search to ensure all possible results are returned, as the approximate search was not able to find all results that matched the filter. This was already done by #14160 - this PR adds tests to check this specific case.
When doing approximate knn search, it's possible that the approximate search returns less than k results. In case there is a filter, we know the filter cost so we can check if there are actually more than k results that match the filter.
In that case, we can switch to exact search to ensure all possible results are returned, as the approximate search was not able to find all results that matched the filter.
This was already done by #14160 - this PR adds tests to check this specific case.