[
https://issues.apache.org/jira/browse/SOLR-18625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ian Springer updated SOLR-18625:
--------------------------------
Summary: eDisMax adds empty pf/bq clauses that defeat the MatchAllDocsQuery
optimization (was: eDisMax adds an empty pf clause when no phrase qualifies,
defeating the MatchAllDocsQuery optimization)
> eDisMax adds empty pf/bq clauses that defeat the MatchAllDocsQuery
> optimization
> -------------------------------------------------------------------------------
>
> Key: SOLR-18625
> URL: https://issues.apache.org/jira/browse/SOLR-18625
> Project: Solr
> Issue Type: Bug
> Components: query parsers
> Affects Versions: 9.9, 10.0
> Reporter: Ian Springer
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When {{pf}} is set and no phrase qualifies for the phrase boost, eDisMax adds
> an empty {{BooleanQuery}} to the main query as a {{SHOULD}} clause. This
> happens with single-term queries and with {{q=:}}. It shows up as {{()}} in
> the parsed query, e.g.:
> {noformat}
> defType=edismax&qf=subject&pf=subject&q=wireless
> -> +(subject:wireless) ()
> {noformat}
> Cause: in {{ExtendedDismaxQParser.addShingledPhraseQueries}}, the pf
> sub-parser runs with {{minClauseSize=2}}. That drops every one-position
> phrase, so {{pp.parse(...)}} returns an empty {{BooleanQuery}} instead of
> {{null}}. The {{phrase != null}} guard therefore lets it through.
> Impact:
> - Scoring is unaffected, because an empty SHOULD clause matches nothing.
> - It defeats the single-clause {{MatchAllDocsQuery}} unwrapping in
> {{ExtendedDismaxQParser.parse()}}. With {{pf}} set, {{q=:}} therefore scores
> a {{BooleanQuery}} over every doc. It misses Solr's {{MatchAllDocsQuery}}
> fast paths (answered from the live-docs set, bypassing the filterCache).
> - Fielded-only queries such as {{q=subject:foo}} produce no pf clauses. They
> still create a sub-parser and analyze an empty phrase for each pf slop group.
> Proposed fix:
> - Skip adding the phrase clause when the parsed result is empty, not just
> when it is null.
> - Return early from {{addShingledPhraseQueries}} when there are no clauses.
> Ranking does not change. This was originally part of SOLR-18314 /
> https://github.com/apache/solr/pull/4652, which was closed because of its
> separate DisMax ranking change. Reviewers agreed this part was safe to merge
> on its own.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]