When searching for multiple phrases in a single query, Solr expands wildcards without taking into account the maxBooleanClause parameter.
Those queries consume a large amount of memory in Solr leading the instance to become unresponsive or even to get OutOfMemory.
Furthermore those queries are taking a long time to execute and increase a lot the load on Solr.
Steps to reproduce
1- Start Alfresco server
2- Import 100 000 documents with the word "test" in their name (eg: test1, test2, ...)
3- Log with into Share
4- Fill the Quick search with: * te* * (pay attention to use spaces as they are really important to reproduce)
5- Take a heapdump while search is executed in Solr
6- Open the heap and check the number of Term in the MultiPhraseQuery objects within BooleanClause.
There is no more than 10000 terms (default solr.maxBooleanClauses) for each BooleanClause.
BooleanQuery$TooManyClauses should be output .
There is more than 10000 terms for MultiPhraseQuery inside BooleanClause.
BooleanQuery$TooManyClauses is not output and he huge amount of memory is necessary to run those queries.
Analysis to date
It is necessary to be able to limit the number of Terms for MultiPhraseQuery as it is the case for simple phrase queries in order to limit the memory used by Solr to reply to these queries.
If multiple complex MultiPhraseQuery are executed simultaneously against the same instance of Solr the instance become unresponsive and OutOfMemory eventually happen.
Issue was first observed on the heapdump of the customer and reproduced on my dev environment with a vanilla 4.1.4 and Solr.