lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: BooleanQuery$TooManyClauses
Date Mon, 11 Jul 2005 12:21:34 GMT

On Jul 11, 2005, at 1:45 AM, xing@mac.com wrote:

> Did a google serach on the problem when using the range search  
> phrase of  "+datefield:[199801 TO 200512]" (date stored as  
> "YYYYMMDD") which returns 1 million hits.
>
> error: org.apache.lucene.search.BooleanQuery$TooManyClauses
>
> Adding "-Dorg.apache.lucene.maxClauseCount=2400" to java option  
> allowed the search query to run without error. The actual value  
> needed is between 2300 and 2400. At 2300 the query fails.
>
> My question is how does Lucene perform range query?  As a bunch of  
> smaller boolean queries? How does one estimate the number of  
> clauses required for a general query and more specifically on a  
> range query?

RangeQuery expands under the covers to a BooleanQuery with all  
matching terms OR'd together.

In your case, if you've indexed a term for every day in that range  
using YYYYMMDD then you've got 2,524 terms roughly = 7 * 365 - 31  
(minus 31 because you'd omit December '05 since you are only going to  
200512).  If all you need is YYYYMM range searching, then index it as  
that (that'd be 7 years * 12 months/year = 84 terms).

     Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message