Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-5344

Flexible StandardQueryParser behaves differently than ClassicQueryParser

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.5
    • 4.6.1, 4.7, 6.0
    • core/queryparser
    • None

    Description

      AnalyzerQueryNodeProcessor creates a BooleanQueryNode instead of a MultiPhraseQueryNode for some circumstances.

      Classic query parser output: +content:a +content:320 (correct)

      QueryParser classicQueryParser;
      classicQueryParser = new QueryParser(Version.LUCENE_45, "content", anaylzer);
      classicQueryParser.setDefaultOperator(Operator.AND);
      classicQueryParser.parse("a320"));
      

      Flexible query parser output: content:a content:320 (wrong)

      StandardQueryParser flexibleQueryParser;
      flexibleQueryParser = new StandardQueryParser(anaylzer);
      flexibleQueryParser.setDefaultOperator(Operator.AND);
      flexibleQueryParser.parse("a320", "content"));
      

      The used analyzer:

      Analyzer anaylzer = return new Analyzer() {
        protected TokenStreamComponents createComponents(String field, Reader in) {
        Tokenizer   src = new WhitespaceTokenizer(Version.LUCENE_45, in);
        TokenStream tok = new WordDelimiterFilter(src,
           WordDelimiterFilter.SPLIT_ON_NUMERICS |
           WordDelimiterFilter.GENERATE_WORD_PARTS |
           WordDelimiterFilter.GENERATE_NUMBER_PARTS,
           CharArraySet.EMPTY_SET); 
        return new TokenStreamComponents(src, tok);
      };
      

      Attachments

        1. LUCENE-5344_adrianocrestani_2014-01-12.patch
          17 kB
          Adriano Crestani
        2. LUCENE-5344_adrianocrestani_2014-01-14_branch_4x.patch
          8 kB
          Adriano Crestani
        3. LUCENE-5344_adrianocrestani_2014-01-14.patch
          17 kB
          Adriano Crestani

        Activity

          People

            adriano_crestani Adriano Crestani
            Krishna Keldec Krishna Keldec
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: