rseitz opened a new pull request, #1154: URL: https://github.com/apache/solr/pull/1154
https://issues.apache.org/jira/browse/SOLR-16496 # Description QueryElevationComponent now accepts a request parameter elevateFilteredDocs that defaults to false. When this parameter is set to false (the default), or not specified at all, elevation respects the fq parameter. That is to say, an elevated document will only be included in the result set if it matches all the provided filter queries. When this parameter is set to true, an elevated document will still be included in the result set even if it doesn't match all of the provided filter queries. In essence, this parameter allows a user to toggle the precedence of elevation versus filtering. Setting the parameter to true supports a use case where an elevated document should always be returned, regardless of other criteria. # Solution The setQuery method in QueryElevationComponent has been updated so that when elevateFilteredDocs=true, each provided filter query is transformed into a boolean OR of the original filter query with a query that matches all of the elevated documents. This is similar to the way the QueryElevationComponent modifies the primary query. When elevateFilteredDocs is omitted or set to false, the behavior is the same as it has been previously (that is to say, filters take precedence over elevation). # Tests A testFQ() method has been added in QueryElevationComponentTest. The test first establishes that by default, the QueryElevationComponent respects the fq parameter. However, when elevateFilteredDocs=true, an elevated document will still be included in the result set even if it would otherwise have been filtered out. Of course, when elevatedDocuments=true, a document that is not elevated should still be subject to the filter conditions. Finally, the behavior of elevateFilteredDocs is consistent when collapsing is involved. # Checklist Please review the following and check all that apply: - [X] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) 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. - [X] 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) - [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) -- 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]
