You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2019/06/11 11:11:58 UTC

[lucene-solr] branch branch_8x updated: LUCENE-8845: Add additional max boolean clause cap on expansion

This is an automated email from the ASF dual-hosted git repository.

romseygeek pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new eee1bc7  LUCENE-8845: Add additional max boolean clause cap on expansion
eee1bc7 is described below

commit eee1bc72a4c95bbc3e148712d404299a90c0c2f9
Author: Alan Woodward <ro...@apache.org>
AuthorDate: Tue Jun 11 11:56:19 2019 +0100

    LUCENE-8845: Add additional max boolean clause cap on expansion
---
 .../org/apache/lucene/search/intervals/MultiTermIntervalsSource.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lucene/sandbox/src/java/org/apache/lucene/search/intervals/MultiTermIntervalsSource.java b/lucene/sandbox/src/java/org/apache/lucene/search/intervals/MultiTermIntervalsSource.java
index 213ef73..9c9b5f9 100644
--- a/lucene/sandbox/src/java/org/apache/lucene/search/intervals/MultiTermIntervalsSource.java
+++ b/lucene/sandbox/src/java/org/apache/lucene/search/intervals/MultiTermIntervalsSource.java
@@ -27,6 +27,7 @@ import java.util.Objects;
 import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.Terms;
 import org.apache.lucene.index.TermsEnum;
+import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.MatchesIterator;
 import org.apache.lucene.search.MatchesUtils;
 import org.apache.lucene.search.QueryVisitor;
@@ -41,6 +42,10 @@ class MultiTermIntervalsSource extends IntervalsSource {
 
   MultiTermIntervalsSource(CompiledAutomaton automaton, int maxExpansions, String pattern) {
     this.automaton = automaton;
+    if (maxExpansions > BooleanQuery.getMaxClauseCount()) {
+      throw new IllegalArgumentException("maxExpansions [" + maxExpansions
+          + "] cannot be greater than BooleanQuery.getMaxClauseCount [" + BooleanQuery.getMaxClauseCount() + "]");
+    }
     this.maxExpansions = maxExpansions;
     this.pattern = pattern;
   }