You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ti...@informa.com on 2006/03/16 17:34:29 UTC

TooManyClauses exception in Lucene (1.4)

Hi,

We're using queryparser to generate my queries (not ideal, and we're
planning on rewriting it, but at the moment we don't have the resources
to do so). 

We have a default field "text" which contains all of our text fields,
and a "date" field which is just a string field in the format YYYY-MM-DD
(so we can sort). 

I'm passing in the query string: broadband AND date:[2005-03-16 TO
2006-03-16]^0.01

(I'm weighting the date portion of the query so it doesn't affect the
sorting too heavily). 

Running query.toString gives this: +text:broadband +date:[2005-03-16 TO
2006-03-16]^0.01

When I try to run the query, though, I get this Exception:

	org.apache.lucene.search.BooleanQuery$TooManyClauses
	at
org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:79)
	at
org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:71)
	at
org.apache.lucene.search.RangeQuery.rewrite(RangeQuery.java:99)
	at
org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:243)
	at
org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:166)
	at org.apache.lucene.search.Query.weight(Query.java:84)
	at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:85)
	at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:64)
	at org.apache.lucene.search.Hits.<init>(Hits.java:43)
	at org.apache.lucene.search.Searcher.search(Searcher.java:33)
	at org.apache.lucene.search.Searcher.search(Searcher.java:27)

I know Lucene 1.4 has a limited number of clauses, but assumed two or
three would be okay. :)

Any ideas would be gratefully received! Oddly, this doesn't seem to
occur every time, just with certain date ranges...

Cheers,

Tim.
--------------------------------------------------------------------------------------------------------------------------------------------
The information contained in this email message may be confidential. If you are not the intended recipient, any use, interference with, disclosure or copying of this material is unauthorised and prohibited. Although this message and any attachments are believed to be free of viruses, no responsibility is accepted by Informa for any loss or damage arising in any way from receipt or use thereof.  Messages to and from the company are monitored for operational reasons and in accordance with lawful business practices. 
If you have received this message in error, please notify us by return and delete the message and any attachments.  Further enquiries/returns can be sent to postmaster@informa.com

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


Re: TooManyClauses exception in Lucene (1.4)

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Tim,

This is possible a lot of days:
  date:[2005-03-16 TO 2006-03-16]
And if your 'date' field is more granular than 'a day', then this is a lot more hours/minutes/seconds/milliseconds.

Your range query is expanded to all unique values in the range.  This is probably in the FAQ, but if not, look at the first snippet:
http://www.lucenebook.com/search?query=indexing+date+millisecond

If you don't need hours/minutes/seconds/milliseconds, don't index them.

Otis


----- Original Message ----
From: Tim.Wright@informa.com
To: java-user@lucene.apache.org
Sent: Thursday, March 16, 2006 11:34:29 AM
Subject: TooManyClauses exception in Lucene (1.4)

Hi,

We're using queryparser to generate my queries (not ideal, and we're
planning on rewriting it, but at the moment we don't have the resources
to do so). 

We have a default field "text" which contains all of our text fields,
and a "date" field which is just a string field in the format YYYY-MM-DD
(so we can sort). 

I'm passing in the query string: broadband AND date:[2005-03-16 TO
2006-03-16]^0.01

(I'm weighting the date portion of the query so it doesn't affect the
sorting too heavily). 

Running query.toString gives this: +text:broadband +date:[2005-03-16 TO
2006-03-16]^0.01

When I try to run the query, though, I get this Exception:

    org.apache.lucene.search.BooleanQuery$TooManyClauses
    at
org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:79)
    at
org.apache.lucene.search.BooleanQuery.add(BooleanQuery.java:71)
    at
org.apache.lucene.search.RangeQuery.rewrite(RangeQuery.java:99)
    at
org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:243)
    at
org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:166)
    at org.apache.lucene.search.Query.weight(Query.java:84)
    at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:85)
    at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:64)
    at org.apache.lucene.search.Hits.<init>(Hits.java:43)
    at org.apache.lucene.search.Searcher.search(Searcher.java:33)
    at org.apache.lucene.search.Searcher.search(Searcher.java:27)

I know Lucene 1.4 has a limited number of clauses, but assumed two or
three would be okay. :)

Any ideas would be gratefully received! Oddly, this doesn't seem to
occur every time, just with certain date ranges...

Cheers,

Tim.
--------------------------------------------------------------------------------------------------------------------------------------------
The information contained in this email message may be confidential. If you are not the intended recipient, any use, interference with, disclosure or copying of this material is unauthorised and prohibited. Although this message and any attachments are believed to be free of viruses, no responsibility is accepted by Informa for any loss or damage arising in any way from receipt or use thereof.  Messages to and from the company are monitored for operational reasons and in accordance with lawful business practices. 
If you have received this message in error, please notify us by return and delete the message and any attachments.  Further enquiries/returns can be sent to postmaster@informa.com

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





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