
Troubleshooting: BooleanQuery TooManyClauses error occurs
A BooleanQuery TooManyClauses error might occur when running queries.
Problem
The following error is displayed:
org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 100
Solution
This issue occurs when queries
reach the maxBooleanClauses
default value that is
set in the solrConfig.xml file.
To resolve this issue, increase the
maxBooleanClauses
value to a higher value.
The optimum value is dependent on your particular configuration. Try an initial, generous value such
as 10000, and if that does not work, attempt again with a higher value. Repeat this process until
you find a value that works on your system.- Set the
maxBooleanClauses
value to 10000 in the solrConfig.xml file.<!-- Max Boolean Clauses Maximum number of clauses in each BooleanQuery, an exception is thrown if exceeded. ** WARNING ** This option actually modifies a global Lucene property that will affect all SolrCores. If multiple solrconfig.xml files disagree on this property, the value at any given moment will be based on the last SolrCore to be initialized. --> <maxBooleanClauses>10000</maxBooleanClauses>
- Save your changes.
- Ensure that all of the active cores contain the same value, as the last core that is initialized sets the global value.
In addition, consider disabling the default Solr core.
This can be done by removing its reference from the solr.xml file:
- Open the solrhome/solr.xml file for editing.
- Locate and remove the following line:
<core instanceDir="default" name="Default"/>
- Save your changes.
- Restart the test server.