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

StandardQueryParser ignores AND operator for tokenized query terms

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.4, 4.0-ALPHA
    • 3.5, 4.0-ALPHA
    • modules/queryparser
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: