You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2015/10/28 10:45:14 UTC

svn commit: r1710970 - in /lucene/dev/trunk/lucene: CHANGES.txt queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java

Author: dweiss
Date: Wed Oct 28 09:45:14 2015
New Revision: 1710970

URL: http://svn.apache.org/viewvc?rev=1710970&view=rev
Log:
LUCENE-6857: Validate StandardQueryParser with NOT operator with-in parantheses

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1710970&r1=1710969&r2=1710970&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Wed Oct 28 09:45:14 2015
@@ -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).
 

Modified: lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java?rev=1710970&r1=1710969&r2=1710970&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java (original)
+++ lucene/dev/trunk/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java Wed Oct 28 09:45:14 2015
@@ -538,7 +538,18 @@ public class TestQPHelper extends Lucene
     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");