lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Ekengren <bjorn.ekeng...@avanza.se>
Subject Best solution for the Date Range problem
Date Mon, 12 Jun 2006 08:51:25 GMT
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

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