lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jayakumar.V" <>
Subject FW: Boolean Query - TooManyClauses Exception
Date Thu, 19 May 2005 13:54:05 GMT

Further to the below, if I remove the RangeQuery, it works beautifully.  :-(

Any pointers to where the issue is ?





From: Jayakumar.V [] 
Sent: Thursday, May 19, 2005 16:40 PM
To: ''
Subject: Boolean Query - TooManyClauses Exception



I'm getting a TooManyClauses Exception when I try to query for a particular
date range. 

I've around 4 million documents with 21 fields each. 

The fields to search into are determined by the user - it can be field F1 or
F2 or both. 

Also there is a date range within which the results need to be restricted.

The date is indexed as a KEYWORD & the fields F1 & F2 are indexed as TEXT.


Following is the code I've used :


Term from = new Term("txnDate", format.format(dateFrom));      --> format
gives the date in yyymmdd format

Term to = new Term("txnDate", format.format(dateTo));


Query rangeQuery = new RangeQuery(from,to,true);


BooleanQuery mainQuery = new BooleanQuery();


// searchIn is an string array containing the fields to look into

for (int i=0; i<searchIn.length; i++) {                                

          TermQuery query = new TermQuery(new




Filter queryFilter = new QueryFilter(mainQuery);


Sort sort = new Sort("txnDate",true);

Hits hits =,queryFilter,sort);


I'm not sure of the way I've constructed the Query. I had used the
BooleanQuery to enable searching in multiple fields.

I'm able to get results to a max. date range of 2 years beyond which it
throws the subject exception.

Any better way to construct the query? 




  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message