Feature Pack 7 or later

Troubleshooting: BooleanQuery TooManyClauses error occurs

A BooleanQuery TooManyClauses error might occur when running queries.


The following error is displayed:

org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 100


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.
  1. 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.
  2. Save your changes.
  3. 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:
  1. Open the solrhome/solr.xml file for editing.
  2. Locate and remove the following line:
    <core instanceDir="default" name="Default"/> 
  3. Save your changes.
  4. Restart the test server.