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

StandardQueryParser ignores AND operator for tokenized query terms

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4, 4.0-ALPHA
    • Fix Version/s: 3.5, 4.0-ALPHA
    • Component/s: modules/queryparser
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      The standard query parser uses the default query operator for query clauses that are created from tokenization in the query parser instead of the actual operator for the source term.

      here is an example:

      StandardQueryParser parser = new StandardQueryParser(new StandardAnalyzer(Version.LUCENE_34));
      parser.setDefaultOperator(Operator.OR);
      System.out.println(((BooleanQuery)parser.parse("_deleted:true AND title:東京", "f")));
      

      this should yield:
      +_deleted:true +(title:東 title:京)

      as our former core query parser does but actually yields:
      +_deleted:true title:東 title:京

      seems like a bug to me, looking at the tests seems we don't test for this kind of queries in the standard query parser tests too.

        Attachments

        1. LUCENE-3542.patch
          4 kB
          Simon Willnauer

          Activity

            People

            • Assignee:
              simonw Simon Willnauer
              Reporter:
              simonw Simon Willnauer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: