Skip to content

Conversation

benwtrent
Copy link
Member

in an effort to simplify and keep from unnecessarily wrapping the bits (which, when null can have optimized internal paths for knn searches), this moves our cancellation checks to a knn collector.

Additionally, it makes more sense for our cancellation checks to be done on collection.

@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Aug 6, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

Comment on lines +259 to +260
while (centroidIterator.hasNext()
&& (centroidsVisited < nProbe || knnCollector.minCompetitiveSimilarity() == Float.NEGATIVE_INFINITY)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were making a bad assumption before, assuming things were an AbstractKnnCollector. Instead, we should use the appropriate measure, which is Has the collector set a minCompetitiveSimilarity indicating it gathered enough vectors.

Copy link
Contributor

@john-wagster john-wagster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@benwtrent benwtrent merged commit a7b434b into elastic:main Aug 7, 2025
33 checks passed
@benwtrent benwtrent deleted the feature/adj-vector-exit-check branch August 7, 2025 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>refactoring :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants