LUCENE-6857: Validate StandardQueryParser with NOT operator with-in parantheses

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1710970 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dawid Weiss 2015-10-28 09:45:14 +00:00
parent 9f1248e841
commit 8b396d82ce
2 changed files with 15 additions and 1 deletions

View File

@ -227,6 +227,9 @@ Bug Fixes
Other
* LUCENE-6857: Validate StandardQueryParser with NOT operator
with-in parantheses. (Jigar Shah via Dawid Weiss)
* LUCENE-6827: Use explicit capacity ArrayList instead of a LinkedList
in MultiFieldQueryNodeProcessor. (Dawid Weiss).

View File

@ -538,7 +538,18 @@ public class TestQPHelper extends LuceneTestCase {
assertQueryEquals("!term", null, "-term");
assertQueryEquals("NOT term", null, "-term");
}
public void testNegationInParentheses() throws Exception {
assertQueryEquals("(-a)", null, "-a");
assertQueryEquals("(!a)", null, "-a");
assertQueryEquals("(NOT a)", null, "-a");
assertQueryEquals("a (!b)", null, "a (-b)");
assertQueryEquals("+a +(!b)", null, "+a +(-b)");
assertQueryEquals("a AND (!b)", null, "+a +(-b)");
assertQueryEquals("a (NOT b)", null, "a (-b)");
assertQueryEquals("a AND (NOT b)", null, "+a +(-b)");
}
public void testWildcard() throws Exception {
assertQueryEquals("term*", null, "term*");
assertQueryEquals("term*^2", null, "(term*)^2.0");