lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Birthday (that's "day" not "date") search query?
Date Tue, 07 Apr 2009 22:00:44 GMT

: Hi everyone,
:      I have an index that stores birth-dates, and I would like to search for
: anybody whose birth-date is within X days of a certain month/day. For
: example, I'd like to know if anybody's birthday is coming up within a
: certain number of days, regardless of what year they were born. How would I
: do this using Solr?

You've already indexed the data as a DateField? ... hmmm .... i can't 
think of any way to do that type of query without writing a custom plugin 
that can iterate over all the terms in the index.

:      As a follow-up, assuming this query is executed very often, should I
: maybe be indexing something other than the birth-date? Such as just the
: month-day pair? What is the most efficient way to do such a query?

if you aren't too picky about leap years, the simplest appraoch would 
probably be to just index the day of the year they were born on as an 
integery ... your query code will have to be a little smart about 
moduloing arround the start/end of the year.

if you are picky about leap years .... hmmm .... i've got nothing.


-Hoss


Mime
View raw message