Skip to content

Apache Lucene open-source search software

maxClauseCount: deprecate public field, no more setting via system property

Daniel Naberd6ee6c084502
diff --git a/CHANGES.txt b/CHANGES.txt
index f17ac3ca987..22d02c4e95d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -45,11 +45,14 @@ Changes in runtime behavior
7. Several default values cannot be set via system properties anymore, as
this has been considered inappropriate for a library like Lucene. For
most properties there are set/get methods available in IndexWriter which
- you should use instead.
- This affects the following properties: org.apache.lucene.writeLockTimeout,
- org.apache.lucene.commitLockTimeout, org.apache.lucene.minMergeDocs,
- org.apache.lucene.maxMergeDocs, org.apache.lucene.maxFieldLength,
- org.apache.lucene.termIndexInterval, org.apache.lucene.mergeFactor
+ you should use instead. This affects the following properties:
+ See IndexWriter for getter/setter methods:
+ org.apache.lucene.writeLockTimeout, org.apache.lucene.commitLockTimeout,
+ org.apache.lucene.minMergeDocs, org.apache.lucene.maxMergeDocs,
+ org.apache.lucene.maxFieldLength, org.apache.lucene.termIndexInterval,
+ org.apache.lucene.mergeFactor,
+ See BooleanQuery for getter/setter methods:
+ org.apache.lucene.maxClauseCount
(Daniel Naber)
New features
diff --git a/src/java/org/apache/lucene/search/BooleanQuery.java b/src/java/org/apache/lucene/search/BooleanQuery.java
index 417ae3d8c00..4265074601b 100644
--- a/src/java/org/apache/lucene/search/BooleanQuery.java
+++ b/src/java/org/apache/lucene/search/BooleanQuery.java
@@ -29,23 +29,10 @@ import org.apache.lucene.index.IndexReader;
*/
public class BooleanQuery extends Query {
- /** The maximum number of clauses permitted. Default value is 1024.
- * Use the <code>org.apache.lucene.maxClauseCount</code> system property
- * to override.
- * <p>TermQuery clauses are generated from for example prefix queries and
- * fuzzy queries. Each TermQuery needs some buffer space during search,
- * so this parameter indirectly controls the maximum buffer requirements for
- * query search.
- * <p>When this parameter becomes a bottleneck for a Query one can use a
- * Filter. For example instead of a {@link RangeQuery} one can use a
- * {@link RangeFilter}.
- * <p>Normally the buffers are allocated by the JVM. When using for example
- * {@link org.apache.lucene.store.MMapDirectory} the buffering is left to
- * the operating system.
+ /**
+ * @deprecated use {@link #setMaxClauseCount(int)} instead
*/
- public static int maxClauseCount =
- Integer.parseInt(System.getProperty("org.apache.lucene.maxClauseCount",
- "1024"));
+ public static int maxClauseCount = 1024;
/** Thrown when an attempt is made to add more than {@link
* #getMaxClauseCount()} clauses. This typically happens if
@@ -57,11 +44,23 @@ public class BooleanQuery extends Query {
/** 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 #maxClauseCount
+ * @see #setMaxClauseCount(int)
*/
public static int getMaxClauseCount() { return maxClauseCount; }
- /** Set the maximum number of clauses permitted. */
+ /** Set the maximum number of clauses permitted per BooleanQuery.
+ * Default value is 1024.
+ * <p>TermQuery clauses are generated from for example prefix queries and
+ * fuzzy queries. Each TermQuery needs some buffer space during search,
+ * so this parameter indirectly controls the maximum buffer requirements for
+ * query search.
+ * <p>When this parameter becomes a bottleneck for a Query one can use a
+ * Filter. For example instead of a {@link RangeQuery} one can use a
+ * {@link RangeFilter}.
+ * <p>Normally the buffers are allocated by the JVM. When using for example
+ * {@link org.apache.lucene.store.MMapDirectory} the buffering is left to
+ * the operating system.
+ */
public static void setMaxClauseCount(int maxClauseCount) {
BooleanQuery.maxClauseCount = maxClauseCount;
}