You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Dawid Weiss (JIRA)" <ji...@apache.org> on 2016/11/10 12:29:59 UTC

[jira] [Created] (LUCENE-7550) QueryParser parses query differently depending on the default operator

Dawid Weiss created LUCENE-7550:
-----------------------------------

             Summary: QueryParser parses query differently depending on the default operator
                 Key: LUCENE-7550
                 URL: https://issues.apache.org/jira/browse/LUCENE-7550
             Project: Lucene - Core
          Issue Type: Bug
            Reporter: Dawid Weiss
            Priority: Minor


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.

{code}
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());
{code}

Results in :
{code}
+test:foo test:bar test:baz
+test:foo +test:bar test:baz
{code}

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org