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

Question :

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

Answer :

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. It kept throwing me a  error, which was very frustrating as I kept looking at my JARs and confirming that none of the included code actually used a boolean query.

Why doesn’t it throw something like a Too Many Hits exception? And why does increasing the boolean query’s static max clauses integer actually make this error go away, when I’m definitely only using a prefix query? Is there something fundamental to how queries are run that I’m not understanding; is it that they secretly become Boolean queries?

Read More  Add multiple window.onload events

,

I’ve hit this before. It has to do with the fact that lucene, under the covers, turns many (all?) things into boolean queries when you call Query.rewrite()

From:

public Query rewrite(IndexReader reader)                throws IOException        Expert: called to re-write queries into primitive queries.              For example, a PrefixQuery will be rewritten into a              BooleanQuery that consists of TermQuerys.        Throws:          IOException  

That’s the answer With Lucene: Why do I get a Too Many Clauses error if I do a prefix search?, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Read More  What rule engine should I use?

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you