You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by prerna07 <pk...@sapient.com> on 2009/06/08 09:17:26 UTC
Query on date fields
Hi,
I have two date attributes in my Indexes:
DisplayStartDate_dt
DisplayEndDate_dt
I need to fetch results where today's date lies between displayStartDate and
dislayEndDate.
However i cannot send hardcoded displayStartdate and displayEndDate date in
query as there are 1000 different dates in indexes
Please suggest the query.
Thanks,
Prerna
--
View this message in context: http://www.nabble.com/Query-on-date-fields-tp23919342p23919342.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Query on date fields
Posted by "Aleksander M. Stensby" <al...@integrasco.no>.
Hello,
for this you can simply use the nifty date functions supplied by SOLR
(given that you have indexed your fields with the solr Date field.
If I understand you correctly, you can achieve what you want with the
following union query:
displayStartDate:[* TO NOW] AND displayEndDate:[NOW TO *]
Cheers,
Aleksander
On Mon, 08 Jun 2009 09:17:26 +0200, prerna07 <pk...@sapient.com>
wrote:
>
>
> Hi,
>
> I have two date attributes in my Indexes:
>
> DisplayStartDate_dt
> DisplayEndDate_dt
>
> I need to fetch results where today's date lies between displayStartDate
> and
> dislayEndDate.
>
> However i cannot send hardcoded displayStartdate and displayEndDate date
> in
> query as there are 1000 different dates in indexes
>
> Please suggest the query.
>
> Thanks,
> Prerna
>
>
>
>
--
Aleksander M. Stensby
Lead software developer and system architect
Integrasco A/S
www.integrasco.no
http://twitter.com/Integrasco
Please consider the environment before printing all or any of this e-mail