• New Feature
  • Status: Resolved
  • 2 Major
  • Resolution: Fixed
  • vfunshte
  • Reporter: teck
  • November 23, 2011
  • 0
  • Watchers: 3
  • January 29, 2013
  • January 29, 2013



Usually the default 1024 limit on boolean clauses is more than sufficient for any reasonable query. Using in() however it isn’t too hard to imagine exceeding the limit.

This item is to allow one to configure the limit. The minimum would be to expose this a tc.property


Karthik Lalithraj 2012-01-27

Issue also encountered by registered customer Jean Martin.

Tim Eck 2012-02-01

Don’t know for sure but using a TermsFilter could be of use here? This is a message from the lucene mailing list that could apply to this problem.

{noformat} I would recommend to use TermsFilter (http://goo.gl/BC9eQ, possibly wrapped by a ConstantScoreQuery). You must do the query building by hand, yuery *parser* cannot do that:

TermsFilter tf = new TermsFilter(); // it is in lucene-queries.jar tf.addTerm(new Term(“id”, val1)); tf.addTerm(new Term(“id”, val2)); tf.addTerm(new Term(“id”, val3)); tf.addTerm(new Term(“id”, val4)); // if you need a query and don’t want to use a Filter: Query wrappedQ = new ConstantScoreQuery(tf);

You can execute the Filter as addon to your already prepared query:

searcher.search(queryParser.parse(“content: (hello world)”), filter,…);

Or you use the wrapped as ConstantScore and combine it with the query:

BooleanQuery bq = new BooleanQuery(); bq.add(queryParser.parse(“content: (hello world)”), BooleanClause.Occur.MUST); bq.add(wrapped, BooleanClause.Occur.MUST); searcher.search(bq,…);


Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: [email protected]

—–Original Message—– From: Praveen Yarlagadda [mailto:[email protected]] Sent: Wednesday, February 01, 2012 8:51 AM To: [email protected] Subject: too many boolean clauses

Hi all,

I have been using lucene with Hibernate to index the data. Each document is indexed with two fields: id and content. Each document corresponds to a record in the database. In my usecase, search needs to work like this:

  1. Fetch records from the database based on some criteria 2. Search for the keywords only in the records found above

I am preparing the search query like this: +(content: (hello world)) +(id: (234 235 899 534 345 898))

If the number of documents (in the identifier field) reaches more than 1024, search fails with “too many boolean clauses”. I can’t use range query.

Is there any other way to prepare the search query? How do I search for keywords in select documents?

If you have any suggestions, please let me know.

Thanks, Praveen

To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]


Vitaliy Funshteyn 2012-11-09

Don’t think I can commit to this by TP2/Vicente code freeze.

Vitaliy Funshteyn 2013-01-29

Implemented as fix for DEV-8775