diff --git a/build.xml b/build.xml
index f13de21c0bd..9fa17addaea 100644
--- a/build.xml
+++ b/build.xml
@@ -97,7 +97,6 @@
- ${javacc.files.uptodate}
diff --git a/src/java/org/apache/lucene/queryParser/QueryParser.java b/src/java/org/apache/lucene/queryParser/QueryParser.java
index 8a0f604954d..51ae895ee64 100644
--- a/src/java/org/apache/lucene/queryParser/QueryParser.java
+++ b/src/java/org/apache/lucene/queryParser/QueryParser.java
@@ -524,6 +524,7 @@ public class QueryParser implements QueryParserConstants {
protected Query getBooleanQuery(Vector clauses) throws ParseException {
return getBooleanQuery(clauses, false);
}
+
/**
* Factory method for generating query, given a set of clauses.
* By default creates a boolean query composed of clauses passed in.
diff --git a/src/java/org/apache/lucene/queryParser/QueryParser.jj b/src/java/org/apache/lucene/queryParser/QueryParser.jj
index 3149ae5f8e9..62ea11dcd0f 100644
--- a/src/java/org/apache/lucene/queryParser/QueryParser.jj
+++ b/src/java/org/apache/lucene/queryParser/QueryParser.jj
@@ -545,8 +545,9 @@ public class QueryParser {
* @exception ParseException throw in overridden method to disallow
*/
protected Query getBooleanQuery(Vector clauses) throws ParseException {
- getBooleanQuery(clauses, false);
+ return getBooleanQuery(clauses, false);
}
+
/**
* Factory method for generating query, given a set of clauses.
* By default creates a boolean query composed of clauses passed in.
diff --git a/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java b/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java
index 5c50e088221..f170cd7d352 100644
--- a/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java
+++ b/src/test/org/apache/lucene/queryParser/precedence/TestPrecedenceQueryParser.java
@@ -170,6 +170,8 @@ public class TestPrecedenceQueryParser extends TestCase {
assertQueryEquals("türm term term", null, "türm term term");
assertQueryEquals("ümlaut", null, "ümlaut");
+ assertQueryEquals("+a", null, "+a");
+ assertQueryEquals("-a", null, "-a");
assertQueryEquals("a AND b", null, "+a +b");
assertQueryEquals("(a AND b)", null, "+a +b");
assertQueryEquals("c OR (a AND b)", null, "c (+a +b)");
@@ -325,6 +327,7 @@ public class TestPrecedenceQueryParser extends TestCase {
assertQueryEquals("term AND NOT phrase term", qpAnalyzer,
"(+term -\"phrase1 phrase2\") term");
assertQueryEquals("stop", qpAnalyzer, "");
+ assertQueryEquals("stop OR stop AND stop", qpAnalyzer, "");
assertTrue(getQuery("term term term", qpAnalyzer) instanceof BooleanQuery);
assertTrue(getQuery("term +stop", qpAnalyzer) instanceof TermQuery);
}
@@ -530,11 +533,9 @@ public class TestPrecedenceQueryParser extends TestCase {
Query query1 = PrecedenceQueryParser.parse("A AND B OR C AND D", "field", new WhitespaceAnalyzer());
Query query2 = PrecedenceQueryParser.parse("(A AND B) OR (C AND D)", "field", new WhitespaceAnalyzer());
assertEquals(query1, query2);
- }
- public void testPrecedenceWithNot() throws Exception {
- Query query1 = PrecedenceQueryParser.parse("A OR B C", "field", new WhitespaceAnalyzer());
- Query query2 = PrecedenceQueryParser.parse("A B C", "field", new WhitespaceAnalyzer());
+ query1 = PrecedenceQueryParser.parse("A OR B C", "field", new WhitespaceAnalyzer());
+ query2 = PrecedenceQueryParser.parse("A B C", "field", new WhitespaceAnalyzer());
assertEquals(query1, query2);
query1 = PrecedenceQueryParser.parse("A AND B C", "field", new WhitespaceAnalyzer());
@@ -548,8 +549,11 @@ public class TestPrecedenceQueryParser extends TestCase {
query1 = PrecedenceQueryParser.parse("A OR NOT B", "field", new WhitespaceAnalyzer());
query2 = PrecedenceQueryParser.parse("A -B", "field", new WhitespaceAnalyzer());
assertEquals(query1, query2);
- }
+ query1 = PrecedenceQueryParser.parse("A OR NOT B AND C", "field", new WhitespaceAnalyzer());
+ query2 = PrecedenceQueryParser.parse("A (-B +C)", "field", new WhitespaceAnalyzer());
+ assertEquals(query1, query2);
+ }
public void tearDown() {