Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-12893

ExtendedSolrQueryParser.newFieldQuery does not use the specified analyzer

    XMLWordPrintableJSON

Details

    • Task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • 8.2
    • query parsers
    • None

    Description

          @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);
          }
      

      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.

      Attachments

        1. SOLR-12893.patch
          1 kB
          Markus Jelsma

        Activity

          People

            Unassigned Unassigned
            markus17 Markus Jelsma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: