With Lucene: Why do I get a Too Many Clauses error if I do a prefix search?

前端 未结 3 1260
慢半拍i
慢半拍i 2021-01-12 07:19

I\'ve had an app doing prefix searches for a while. Recently the index size was increased and it turned out that some prefixes were too darned numerous for lucene to handle.

3条回答
  •  情深已故
    2021-01-12 08:14

    When running a prefix query, Lucene searches for all terms in its "dictionary" that match the query. If more than 1024 (by default) match, the TooManyClauses-Exception is thrown.

    You can call BooleanQuery.setMaxClauseCount to increase the maximum number of clauses permitted per BooleanQuery.

提交回复
热议问题