mirror of https://github.com/apache/lucene.git
Make some BooleanQuery methods public and a new `#add(Collection)` method for BQ builder (#13950)
This commit is contained in:
parent
c788be34f1
commit
e8c2218c3a
|
@ -10,6 +10,8 @@ API Changes
|
||||||
|
|
||||||
* GITHUB#13859: Allow open-ended ranges in Intervals range queries. (Mayya Sharipova)
|
* GITHUB#13859: Allow open-ended ranges in Intervals range queries. (Mayya Sharipova)
|
||||||
|
|
||||||
|
* GITHUB#13950: Make BooleanQuery#getClauses public and add #add(Collection<BooleanClause>) to BQ builder. (Shubham Chaudhary)
|
||||||
|
|
||||||
|
|
||||||
New Features
|
New Features
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
@ -87,6 +87,22 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a collection of BooleanClauses to this {@link Builder}. Note that the order in which
|
||||||
|
* clauses are added does not have any impact on matching documents or query performance.
|
||||||
|
*
|
||||||
|
* @throws IndexSearcher.TooManyClauses if the new number of clauses exceeds the maximum clause
|
||||||
|
* number
|
||||||
|
*/
|
||||||
|
public Builder add(Collection<BooleanClause> collection) {
|
||||||
|
// see #addClause(BooleanClause)
|
||||||
|
if ((clauses.size() + collection.size()) > IndexSearcher.maxClauseCount) {
|
||||||
|
throw new IndexSearcher.TooManyClauses();
|
||||||
|
}
|
||||||
|
clauses.addAll(collection);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new clause to this {@link Builder}. Note that the order in which clauses are added does
|
* Add a new clause to this {@link Builder}. Note that the order in which clauses are added does
|
||||||
* not have any impact on matching documents or query performance.
|
* not have any impact on matching documents or query performance.
|
||||||
|
@ -136,7 +152,7 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the collection of queries for the given {@link Occur}. */
|
/** Return the collection of queries for the given {@link Occur}. */
|
||||||
Collection<Query> getClauses(Occur occur) {
|
public Collection<Query> getClauses(Occur occur) {
|
||||||
return clauseSets.get(occur);
|
return clauseSets.get(occur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue