Apache Lucene open-source search software
LUCENE-6570: Make BooleanQuery.Builder.add(Query,Occur) return this, like other methods.
Adrien Grand247f49c297ad
diff --git a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.javaindex e6d68690c62..d7bb422951b 100644--- a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java+++ b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java@@ -118,12 +118,13 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {/*** @throws TooManyClauses if the new number of clauses exceeds the maximum clause number*/- public void add(Query query, Occur occur) {+ public Builder add(Query query, Occur occur) {if (clauses.size() >= maxClauseCount) {throw new TooManyClauses();}query = query.clone(); // be defensiveclauses.add(new BooleanClause(query, occur));+ return this;}/** Create a new {@link BooleanQuery} based on the parameters that have