lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mile Rosu" <mile.r...@level7.ro>
Subject RE: Best solution for the Date Range problem
Date Mon, 12 Jun 2006 11:49:44 GMT
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:bjorn.ekengren@avanza.se] 
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message