Hmmm, doing this with date ranges would be a possibility, although
that would be some really ugly filter queries...

What would happen if you indexed a separate field that was just
the last digit of the year, plus separate fields for year day and month? This
assumes that 1, 5 and 10 are the only ranges you'll need. Also,
you'd have to index the month and day separately. Then your 5
year query would be year_digit:(1 OR 6) AND dd:17 AND mm:08
AND year:[* TO 2010]

Your 10 year query would just be year_digit:1 AND dd:17 AND
mm:08 AND year:[* TO 2010]

Of course this all falls down when if you have to find anniversaries
like every 3 years....

Hmmmmm, I haven't thought this through, but what about something
like indexing some fields like five_year_marker and ten_year_marker
where these fields were a synthetic number that you could use as a
single query. Let's say my birth date is 1980. I know when all my
10 year dates are, so I project the 10 year anniversary forward to, say,
some canonical date (say the first year >= 2100). Now,
you have a single field in your record for the ten_year_marker of
2100, and the same for five_year_marker. When you want all of
the 5 year anniversaries, you project the current year to the same
canonical date (2100) and your AND clause is just AND five_year_marker:2100.

It seems this works for any arbitrary anniversary interval, at the cost
of one number per user for each anniversary interval you care about.

And the one-year stuff is just going at the month and day (probably need
to index separately). Or you could even project that too, except every
user would have a one_year_marker of 2100....

As I say, I haven't really thought this through entirely, what do you think?

Best
Erick

On Wed, Aug 17, 2011 at 3:37 AM, slaava <slaav...@gmail.com> wrote:
> Thanks for quick reply!
>
> Yes, this is my backup solution. But I prefer some one-query approach -
> there could be many results so I want use SolrQuery.start() and
> SolrQuery.rows() and show persons in table with paging.
>
> Are you sure mod() function is supported now? It isn't included in Math.*
> function list here  http://wiki.apache.org/solr/FunctionQuery#Math..2A
> http://wiki.apache.org/solr/FunctionQuery#Math..2A . I'm not on my
> job-computer now so I couldn't test it. But if there really modulus is, it
> will be great!
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Periodic-search-in-date-field-tp3260793p3260896.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to