On Thu, Jan 8, 2009 at 3:38 PM, prerna07 <pkhandelw...@sapient.com> wrote:

>
>
>
> My requirement is to fetch records whthin range of 45 days.
>
> 1) ?q=date_field:[NOW TO NOW-45DAYS] is not returning any results

this works for me if you interchange the range limits viz. [NOW-45DAYS TO
NOW]

>
> 2)  ?q=date_field:[NOW TO NOW+45DAYS] is throwing exception

this too works for me.

Have you defined the date_field field as solr.DateField type in the schema?
date_field should be of type solr.DateField to use range query.

>
>
> however I get correct results when i run following  query :
>  ?q=date_field:[* TO NOW]
>
> Please suggest the correct query for range with days.
>
> Thanks,
> Prerna
>
>
>
>
>
> Akshay-8 wrote:
> >
> > You can use DateMath as:
> >
> > date_field:[NOW TO NOW+45DAYS]
> >
> > On Wed, Jan 7, 2009 at 3:00 PM, prerna07 <pkhandelw...@sapient.com>
> wrote:
> >
> >>
> >> Hi,
> >>
> >>  what will be the syntax of this sql query
> >>  SELECT * FROM table WHERE date > SYSDATE and  date <SYSDATE+45
> >>  in solr format ?
> >>
> >>  I need to fetch records where date is between current date and 45 days
> >> from
> >> today.
> >>
> >> Thanks,
> >> Prerna
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Solr-query-for-date-tp21327696p21327696.html
> >> Sent from the Solr - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Regards,
> > Akshay Ukey.
> >
> > Enjoy your job, make lots of money, work within the law. Choose any two.
> > -Author Unknown.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Solr-query-for-date-tp21327696p21349038.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>


-- 
Regards,
Akshay Ukey.

Reply via email to