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 solr2020 <ps...@gmail.com> on 2016/08/16 11:51:49 UTC

solr date range query

Hi,

We have list of events with events start date and end date.for eg:
event1 starts @ 2nd Aug 2016 ends @ 3rd Aug 2016
event2 starts @ 4th Aug 2016 ends @ 5th Aug 2016
event3 starts @ 1st Aug 2016 ends @ 7th Aug 2016
event4 starts @ 15th july 2016 ends @ 15th Aug 2016

when user selects a date range Aug 2nd to Aug 5th 2016 we are able to fetch
event1 and event2 with start and end date range query (Aug 2nd  TO Aug 5th
). But as event3 and event4 are also an ongoing event we need to fetch that
. how this can be achieved?

Thanks.



--
View this message in context: http://lucene.472066.n3.nabble.com/solr-date-range-query-tp4291918.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: solr date range query

Posted by GW <th...@gmail.com>.
This query would indicate two multivalued fields

This query will return results if you put in a value for the field
eventEnddate of 10 years ago as long as the field eventStartdate is
satisfied.





On 16 August 2016 at 08:16, solr2020 <ps...@gmail.com> wrote:

> eventStartdate:[2016-08-02T00:00:00Z TO 2016-08-05T23:59:59.999Z] OR
> eventEnddate:[2016-08-02T00:00:00Z TO 2016-08-05T23:59:59.999Z]
>
> this is my query.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/solr-date-range-query-tp4291918p4291922.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: solr date range query

Posted by solr2020 <ps...@gmail.com>.
eventStartdate:[2016-08-02T00:00:00Z TO 2016-08-05T23:59:59.999Z] OR
eventEnddate:[2016-08-02T00:00:00Z TO 2016-08-05T23:59:59.999Z]

this is my query.



--
View this message in context: http://lucene.472066.n3.nabble.com/solr-date-range-query-tp4291918p4291922.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: solr date range query

Posted by GW <th...@gmail.com>.
can you send the query you are using?

On 16 August 2016 at 08:03, solr2020 <ps...@gmail.com> wrote:

> yes. dates are stored as a single valued date field
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/solr-date-range-query-tp4291918p4291920.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: solr date range query

Posted by solr2020 <ps...@gmail.com>.
yes. dates are stored as a single valued date field



--
View this message in context: http://lucene.472066.n3.nabble.com/solr-date-range-query-tp4291918p4291920.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: solr date range query

Posted by GW <th...@gmail.com>.
Am I to assume these dates are stored in a single multivalued field?

On 16 August 2016 at 07:51, solr2020 <ps...@gmail.com> wrote:

> Hi,
>
> We have list of events with events start date and end date.for eg:
> event1 starts @ 2nd Aug 2016 ends @ 3rd Aug 2016
> event2 starts @ 4th Aug 2016 ends @ 5th Aug 2016
> event3 starts @ 1st Aug 2016 ends @ 7th Aug 2016
> event4 starts @ 15th july 2016 ends @ 15th Aug 2016
>
> when user selects a date range Aug 2nd to Aug 5th 2016 we are able to fetch
> event1 and event2 with start and end date range query (Aug 2nd  TO Aug 5th
> ). But as event3 and event4 are also an ongoing event we need to fetch that
> . how this can be achieved?
>
> Thanks.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.
> nabble.com/solr-date-range-query-tp4291918.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: solr date range query

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Solr does support a Date Range field, though it is not super documented:
https://cwiki.apache.org/confluence/display/solr/Working+with+Dates
http://wiki.apache.org/solr/DateRangeField
https://issues.apache.org/jira/browse/SOLR-6103

There is also an older trick of using Spatial to index date ranges. It
takes a bit to wrap the head around, but is quite interesting.
https://wiki.apache.org/solr/SpatialForTimeDurations

Regards,
   Alex.
----
Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/


On 16 August 2016 at 21:51, solr2020 <ps...@gmail.com> wrote:
> Hi,
>
> We have list of events with events start date and end date.for eg:
> event1 starts @ 2nd Aug 2016 ends @ 3rd Aug 2016
> event2 starts @ 4th Aug 2016 ends @ 5th Aug 2016
> event3 starts @ 1st Aug 2016 ends @ 7th Aug 2016
> event4 starts @ 15th july 2016 ends @ 15th Aug 2016
>
> when user selects a date range Aug 2nd to Aug 5th 2016 we are able to fetch
> event1 and event2 with start and end date range query (Aug 2nd  TO Aug 5th
> ). But as event3 and event4 are also an ongoing event we need to fetch that
> . how this can be achieved?
>
> Thanks.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/solr-date-range-query-tp4291918.html
> Sent from the Solr - User mailing list archive at Nabble.com.