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

QueryParser parses query differently depending on the default operator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • 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

            dweiss Dawid Weiss
            dweiss Dawid Weiss
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: