Hello, You might consider using the suggestion at http://wiki.apache.org/jakarta-lucene/LargeScaleDateRangeProcessing We successfully used it to search for wide date ranges, on a relatively large number of date records. Using this approach simplifies a lot the query you are suggesting (3). Gluing YYYY and MM in a field like YYYYMM also would make your query look nicer.
Greets, Mile Rosu -----Original Message----- From: Björn Ekengren [mailto:[EMAIL PROTECTED] Sent: Monday, June 12, 2006 11:51 AM To: java-user@lucene.apache.org Subject: Best solution for the Date Range problem Hi, I would like users to be able to search on both terms and within a date range. The solutions I have come across so far are: 1. Use the default QueryParser which will use RangeQuery which will expand into a number of Boolean clauses. It is quite likely that this will run into the TooManyClauses error. 2. Extend QueryParser and override getRangeQuery() and let it return a FilteredQuery containing a RangeFilter. 3. Split Dates during indexing into YYYY, MM, DD and create a custom RangeQuery that uses only the granularity needed: +date[20040830 TO 20060202] expands to (year:2004 AND month:08 AND day:30) OR (year:2004 AND month:08 AND day:31) OR (year:2004 AND month:09) OR (year:2004 AND month:10) OR (year:2004 AND month:11) OR (year:2004 AND month:12) OR (year:2005) OR (year:2006 AND month:01) OR (year:2006 AND month:02 AND day:01) OR (year:2006 AND month:02 AND day:02) Are there any other options, and which one is the best ? /B --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]