You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Adriano Crestani (JIRA)" <ji...@apache.org> on 2014/01/22 05:23:19 UTC
[jira] [Closed] (LUCENE-3565) StandardQueryParser generates
incorrect query for groups containing one term if using default operator
AND
[ https://issues.apache.org/jira/browse/LUCENE-3565?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adriano Crestani closed LUCENE-3565.
------------------------------------
Resolution: Not A Problem
> StandardQueryParser generates incorrect query for groups containing one term if using default operator AND
> ----------------------------------------------------------------------------------------------------------
>
> Key: LUCENE-3565
> URL: https://issues.apache.org/jira/browse/LUCENE-3565
> Project: Lucene - Core
> Issue Type: Bug
> Components: modules/queryparser
> Affects Versions: 3.4
> Reporter: Trejkaz
> Labels: queryparser
>
> The following test demonstrates a bug in StandardQueryParser when DEFAULT_OPERATOR is set to AND:
> {code}
> @Test
> public void testDefaultOperatorSingleGrouped() throws Exception
> {
> StandardQueryParser parser = new StandardQueryParser();
> parser.getQueryConfigHandler().set(StandardQueryConfigHandler.ConfigurationKeys.DEFAULT_OPERATOR, StandardQueryConfigHandler.Operator.AND);
> BooleanQuery expectedQuery = new BooleanQuery();
> BooleanQuery innerQuery1 = new BooleanQuery();
> innerQuery1.add(new TermQuery(new Term("text", "a")), BooleanClause.Occur.MUST);
> expectedQuery.add(innerQuery1, BooleanClause.Occur.SHOULD);
> BooleanQuery innerQuery2 = new BooleanQuery();
> innerQuery2.add(new TermQuery(new Term("text", "b")), BooleanClause.Occur.MUST);
> expectedQuery.add(innerQuery2, BooleanClause.Occur.SHOULD);
> Query actualQuery = parser.parse("(a) OR (b)", "text");
> assertEquals("Wrong query was generated", expectedQuery, actualQuery);
> }
> {code}
> BooleanSingleChildOptimizationQueryNodeProcessor appears to be responsible because if I remove it, the correct query is generated (however, doing so breaks a number of other tests of our own.)
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org