diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 1d0e1aa7c4a..4060e0b6efc 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -22,8 +22,10 @@ API Changes byte[] that stores the UTF-8 bytes of the stored string. (Namgyu Kim via Adrien Grand) -* LUCENE-8811: Deprecated BooleanQuery#setMaxClauseCount() and getMaxClauseCount - have been removed (Atri Sharma, Adrien Grand, Alan Woodward) +* LUCENE-8811: BooleanQuery#setMaxClauseCount() and #getMaxClauseCount() have + moved to IndexSearcher. The checks are now implemented using a QueryVisitor + and apply to all queries, rather than only booleans. (Atri Sharma, Adrien + Grand, Alan Woodward) Improvements @@ -60,11 +62,6 @@ API Changes This change is fully backwards compatible since ExecutorService directly implements Executor. (Simon Willnauer) -* LUCENE-8811: BooleanQuery#setMaxClauseCount() and #getMaxClauseCount() have - moved to IndexSearcher. The checks are now implemented using a QueryVisitor - and apply to all queries, rather than only booleans. (Atri Sharma, Adrien - Grand, Alan Woodward) - * LUCENE-8856: Intervals queries have moved from the sandbox to the queries module. (Alan Woodward) diff --git a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java index 60348fa7676..5f138905966 100644 --- a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java @@ -41,6 +41,34 @@ import org.apache.lucene.search.BooleanClause.Occur; */ public class BooleanQuery extends Query implements Iterable { + /** Thrown when an attempt is made to add more than {@link + * #getMaxClauseCount()} clauses. This typically happens if + * a PrefixQuery, FuzzyQuery, WildcardQuery, or TermRangeQuery + * is expanded to many terms during search. + * @deprecated use {@link IndexSearcher.TooManyClauses} + */ + @Deprecated // Remove in Lucene 10 + public static class TooManyClauses extends IndexSearcher.TooManyClauses { } + + /** Return the maximum number of clauses permitted, 1024 by default. + * Attempts to add more than the permitted number of clauses cause {@link + * TooManyClauses} to be thrown. + * @see IndexSearcher#setMaxClauseCount(int) + * @deprecated use {@link IndexSearcher#getMaxClauseCount()} + */ + @Deprecated // Remove in Lucene 10 + public static int getMaxClauseCount() { return IndexSearcher.getMaxClauseCount(); } + + /** + * Set the maximum number of clauses permitted per BooleanQuery. + * Default value is 1024. + * @deprecated use {@link IndexSearcher#setMaxClauseCount(int)} + */ + @Deprecated // Remove in Lucene 10 + public static void setMaxClauseCount(int maxClauseCount) { + IndexSearcher.setMaxClauseCount(maxClauseCount); + } + /** A builder for boolean queries. */ public static class Builder {