eliaporciani opened a new pull request, #3941: URL: https://github.com/apache/solr/pull/3941
https://issues.apache.org/jira/browse/SOLR-17928 # Description This PR is based on #3711, which appears inactive. I fetched the original commits, merged them with the latest main, resolved conflicts, and pushed this updated branch to help move the contribution forward. All original commits are preserved, and full credit goes to the original author, who has been added as a contributor to this PR. The previous version introduced an efSearch parameter. After review, this has been replaced with efSearchScaleFactor parameter. This parameter controls how much the KNN query should overfetch. If not set, it defaults to 1, meaning no overfetching beyond topK × 1. # Solution The KNN execution now derives the internal efSearch value by multiplying topK with the user-provided efSearchScaleFactor. This allows controlled overfetching without exposing efSearch directly. To apply this logic cleanly, new wrapper query classes (SolrKnnFloatVectorQuery and SolrKnnByteVectorQuery) were introduced. These delegate to Lucene’s KNN queries while injecting the scaled efSearch value before execution. During this update, I also: * added handling to reject invalid NaN values for the parameter * introduced a more appropriate exception type when the parameter is malformed. # Tests Tests were updated to reflect the new behavior, ensuring that: * Queries with efSearch parameters work correctly * Invalid efSearchScaleFactor inputs (e.g., NaN) produce the expected exception. # Checklist Please review the following and check all that apply: - [x] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability. - [x] I have created a Jira issue and added the issue ID to my pull request title. - [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation) - [x] I have developed this patch against the `main` branch. - [x] I have run `./gradlew check`. - [x] I have added tests for my changes. - [x] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide) - [x] I have added a [changelog entry](https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc) for my change -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
