[
https://issues.apache.org/jira/browse/SOLR-12243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16444682#comment-16444682
]
Elizabeth Haubert commented on SOLR-12243:
------------------------------------------
I think the problem is EdismaxQParser:: ln 1393. super.getFieldQuery returns a
SpanNearQuery, which is not an instanceof type BooleanQuery or PhraseQuery or
MultiPhraseQuery. So the query parser decides it didn't get a legit phrase
query back, and throws it out.
What is the history around what query types are allowed as a phrase query and
which aren't?
private Query getQuery() {
try {
switch (type) {
case FIELD: // fallthrough
case PHRASE:
Query query;
if (val == null) {
query = super.getFieldQuery(field, vals, false);
} else {
query = super.getFieldQuery(field, val, type == QType.PHRASE, false);
}
// Boolean query on a whitespace-separated string
// If these were synonyms we would have a SynonymQuery
if (query instanceof BooleanQuery) {
BooleanQuery bq = (BooleanQuery) query;
query = SolrPluginUtils.setMinShouldMatch(bq, minShouldMatch, false);
}
if (query instanceof PhraseQuery) {
PhraseQuery pq = (PhraseQuery)query;
if (minClauseSize > 1 && pq.getTerms().length < minClauseSize) return null;
PhraseQuery.Builder builder = new PhraseQuery.Builder();
Term[] terms = pq.getTerms();
int[] positions = pq.getPositions();
for (int i = 0; i < terms.length; ++i) {
builder.add(terms[i], positions[i]);
}
builder.setSlop(slop);
query = builder.build();
} else if (query instanceof MultiPhraseQuery) {
MultiPhraseQuery mpq = (MultiPhraseQuery)query;
if (minClauseSize > 1 && mpq.getTermArrays().length < minClauseSize) return
null;
if (slop != mpq.getSlop()) {
query = new MultiPhraseQuery.Builder(mpq).setSlop(slop).build();
}
*} else if (minClauseSize > 1) {*
*// if it's not a type of phrase query, it doesn't meet the minClauseSize
requirements*
*return null;*
*}*
> Edismax missing phrase queries when phrases contain multiterm synonyms
> ----------------------------------------------------------------------
>
> Key: SOLR-12243
> URL: https://issues.apache.org/jira/browse/SOLR-12243
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: query parsers
> Affects Versions: 7.1
> Environment: RHEL, MacOS X
> Do not believe this is environment-specific.
> Reporter: Elizabeth Haubert
> Priority: Major
>
> synonyms.txt:
> allergic, hypersensitive
> aspirin, acetylsalicylic acid
> dog, canine, canis familiris, k 9
> rat, rattus
> request handler:
> <requestHandler name="/test_qparse_error" class="solr.SearchHandler">
> <lst name="defaults">
> <!-- Query settings -->
> <str name="defType">edismax</str>
> <str name="tie"> 0.4</str>
> <str name="qf">title^100</str>
> <str name="pf">title~20^5000</str>
> <str name="pf2">title~11</str>
> <str name="pf3">title~22^1000</str>
> <str name="df">text</str>
> <!-- mm If two or fewer clauses exist, they all must match.
> If three to five clauses exist, one can be missing. If six to eight clauses
> exist, all but three must match.
> If more than nine clauses exist, only require 30% to match.-->
> <str name="mm">3<-1 6<-3 9<30%</str>
> <str name="q.alt">*:*</str>
> <str name="rows">25</str>
> </lst>
> </requestHandler>
> Phrase queries (pf, pf2, pf3) containing "dog" or "aspirin" against the
> above list will not be generated.
> "allergic reaction dog" will generate pf2: "allergic reaction", but not
> pf:"allergic reaction dog", pf2: "reaction dog", or pf3: "allergic reaction
> dog"
> "aspirin dose in rats" will generate pf3: "dose ? rats" but not pf2: "aspirin
> dose" or pf3:"aspirin dose ?"
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]