You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Markus Jelsma (JIRA)" <ji...@apache.org> on 2018/10/22 10:33:00 UTC

[jira] [Created] (SOLR-12893) ExtendedSolrQueryParser.newFieldQuery does not use the specified analyzer

Markus Jelsma created SOLR-12893:
------------------------------------

             Summary: ExtendedSolrQueryParser.newFieldQuery does not use the specified analyzer
                 Key: SOLR-12893
                 URL: https://issues.apache.org/jira/browse/SOLR-12893
             Project: Solr
          Issue Type: Task
      Security Level: Public (Default Security Level. Issues are Public)
          Components: query parsers
            Reporter: Markus Jelsma
             Fix For: master (8.0)
         Attachments: SOLR-12893.patch

{code}
    @Override
    protected Query newFieldQuery(Analyzer analyzer, String field, String queryText, 
                                  boolean quoted, boolean fieldAutoGenPhraseQueries, boolean enableGraphQueries,
                                  SynonymQueryStyle synonymQueryStyle)
        throws SyntaxError {
      Analyzer actualAnalyzer;
      if (removeStopFilter) {
        if (nonStopFilterAnalyzerPerField == null) {
          nonStopFilterAnalyzerPerField = new HashMap<>();
        }
        actualAnalyzer = nonStopFilterAnalyzerPerField.get(field);
        if (actualAnalyzer == null) {
          actualAnalyzer = noStopwordFilterAnalyzer(field);
        }
      } else {
        actualAnalyzer = parser.getReq().getSchema().getFieldType(field).getQueryAnalyzer();
      }
      return super.newFieldQuery(actualAnalyzer, field, queryText, quoted, fieldAutoGenPhraseQueries, enableGraphQueries, synonymQueryStyle);
    }
{code}

The given Analyzer is not passed down to its super classes, preventing extending classes to construct their own modified analyzers (which i need). As a side, the nonStopFilterAnalyzerPerField cache is never filled, this patch also fixes that issue.

Two tests fail:
   [junit4]   - org.apache.solr.search.TestExtendedDismaxParser.testFocusQueryParser
   [junit4]   - org.apache.solr.search.TestExtendedDismaxParser.testPfPs

Specifically tests on pf3, i have no idea why so far.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org