[ http://issues.apache.org/jira/browse/SOLR-71?page=comments#action_12450981 ] Bertrand Delacretaz commented on SOLR-71: -----------------------------------------
This looks like a very useful feature! > New support for "Date Math" when adding/quering date fields > ----------------------------------------------------------- > > Key: SOLR-71 > URL: http://issues.apache.org/jira/browse/SOLR-71 > Project: Solr > Issue Type: New Feature > Components: search, update > Reporter: Hoss Man > Assigned To: Hoss Man > Attachments: DateMath.patch > > > New utility class and changes to DateField to support syntax like the > following... > startDate:[* TO NOW] > startDate:[* TO NOW/DAY+1DAY] > expirationDate:[NOW/DAY TO *] > reviewDate:[NOW/DAY-1YEAR TO NOW/DAY] > validDate:[NOW/MONTH TO NOW/MONTH+1MONTH-1MILLISECOND] > ...where + and - mean what you think, and "/UNIT" rounds down to the nearest > UNIT. The motivation for this being that date range queries like these are > usefull for filters, but being date sensitve can't currently be "baked in" to > a config as default params. > a nice side effect of the implimentation, is that "timestamp" fields can be > done with a document is added by using... > <field name="myTimestampField">NOW</field> > ...and Solr will compute the value when adding the document ... if we add > default values to the schema.xml even that won't be neccessary. > Comments? > (I'd be particularly gratefull if smarter people then I would sanity check my > use of ThreadLocal for managing the DateFormat in DateField ... i've never > used ThreadLocal before. Any general comments on the syntax would also be > appreciated: This left-to-right syntax seemed more intuative to write (and > easier to parse) then some of the other syntaxes I'd considered) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira