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

QueryParser parses query differently depending on the default operator

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      As explained by Paweł Róg on java-user [1], the output of parsing the queries below is different depending on the default operator. This looks odd and should be investigated.

      QueryParser parser = new QueryParser("test", new WhitespaceAnalyzer());
      
          parser.setDefaultOperator(QueryParser.Operator.AND);
          Query query = parser.parse("foo AND bar OR baz ");
          System.out.println(query.toString());
      
          parser.setDefaultOperator(QueryParser.Operator.OR);
          query = parser.parse("foo AND bar OR baz ");
          System.out.println(query.toString());
      

      Results in :

      +test:foo test:bar test:baz
      +test:foo +test:bar test:baz
      

      [1] http://mail-archives.apache.org/mod_mbox/lucene-java-user/201611.mbox/browser

        Attachments

          Activity

            People

            • Assignee:
              dweiss Dawid Weiss
              Reporter:
              dweiss Dawid Weiss
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: