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 Steven White <sw...@gmail.com> on 2019/07/05 14:11:11 UTC

Searching on dates and time

Hi everyone,

I'm using Solr 7.2.1 but can upgrade if I must.

I setup my schema like so:

    <fieldType name="dateRange" class="solr.DateRangeField"/>
    <field name="CC_FILE_DATETIME"   type="dateRange"      indexed="true"
required="true"    stored="false"  multiValued="false" />

And indexed my data like so:

    doc.addField("CC_FILE_DATETIME", "2019-02-05T12:04:00Z");;

When I try to search against this field, some search are working, others
are not.  Here are examples

    I get a hit: CC_FILE_DATETIME:"2019-02-05"
    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12"
    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04"
    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04:00Z"

I'm seeing issues with range search took, like so:

    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04 TO
2019-02-06:12:00"

It looks to me that anytime I include the time part, it won't work and yes
I tried escaping ":" like so "\:" but that didn't help.

Can someone guide me through this?

Thank you

Steven

Re: Searching on dates and time

Posted by Erick Erickson <er...@gmail.com>.
<fieldType name="pdate" class="solr.DatePointField" docValues=“true” indexed=“true” />

There should be a number of these in the example schemas, although perhaps without indexed=“true” in the fieldType...

DateRanges are pretty cool, but this in the “keep it simple” category, you might just be able to use plain pdates with the standard [time TO time] syntax.

Although when I try your example (this is on 8.1), all your examples return the document when using DateRange. I indexed the doc with SolrJ just as you did. I was trying queries the admin UI and with quotes didn’t need to escape, with quotes I did, don’t know if daterange behavior has changed since 7.3. I don’t see any JIRAs on a quick scan that look pertinent.

The range works too if
1> you include the square brackets like all other range fields
2> correctly format the end date, 2019-02-06T12:00 not 2019-02-06:12:00.

BTW, the sweet spot for DateRange is you can, well, index a range, as: 
doc.addField(“dfield", "[2019-02-05T12:04:00Z TO 2019-02-06T12:04:00Z]”);
If all you’re trying to do is index a single point in time, I’d recommend pdate.

Best,
Erick

> On Jul 5, 2019, at 6:19 PM, Steven White <sw...@gmail.com> wrote:
> 
> Achieving the use-case is a must.  So if here is an alternative to
> using solr.DateRangeField,
> I'm willing to use it.  What do you mean by "pdate" and what is it?
> 
> I'm reading this link on how to use DateRangeField but yet it is not
> working for me:
> https://lucene.apache.org/solr/guide/6_6/working-with-dates.html  Is the
> issue with my schema the way i set it up?  The way I'm indexing the data?
> Or something else?
> 
> Steven
> 
> On Fri, Jul 5, 2019 at 3:03 PM Erick Erickson <er...@gmail.com>
> wrote:
> 
>> I think what Mikhail is asking is whether your use-case would be satisfied
>> by just indexing a standard pdate rather than a daterange, then querying
>> by
>> 
>> fq=CC_FILE_DATETIME:[some_date/MONTH TO some_maybe_other_full_date].
>> 
>> With regular pdates, you can use “date math” to round to whatever you want
>> on one or both parts of the query.
>> 
>> A note you might be interested in about “fq” clauses and dates in the
>> filter cache:
>> 
>> https://dzone.com/articles/solr-date-math-now-and-filter
>> 
>> Best,
>> Erick
>> 
>>> On Jul 5, 2019, at 11:55 AM, Steven White <sw...@gmail.com> wrote:
>>> 
>>> I need both: point in time and range.  In both cases, I need to be able
>> to
>>> search between just 2 years, between year-month to year-month-day-time,
>>> etc.  So getting my schema right, what and how I index right and the
>> search
>>> syntax right are all important.  This is why, in my original post, I
>> shared
>>> my schema, what I'm indexing and search syntax I'm trying to use.  If I
>> got
>>> anything wrong here to get the feature working right, please let me know.
>>> 
>>> Steven.
>>> 
>>> On Fri, Jul 5, 2019 at 2:16 PM Mikhail Khludnev <mk...@apache.org> wrote:
>>> 
>>>> Hold on. Do you need a range or just point in time?
>>>> 
>>>> On Fri, Jul 5, 2019 at 6:51 PM Steven White <sw...@gmail.com>
>> wrote:
>>>> 
>>>>> Thanks Mikhail.  I will read those links and switch over to latest
>> Solr.
>>>>> 
>>>>> Just to be sure, my schema setup and the way I'm indexing the date data
>>>> are
>>>>> not the issue, right?
>>>>> 
>>>>> Steven.
>>>>> 
>>>>> On Fri, Jul 5, 2019 at 11:05 AM Mikhail Khludnev <mk...@apache.org>
>>>> wrote:
>>>>> 
>>>>>> Hello,
>>>>>> 
>>>>>> The indexed daterange value is really narrow, it might not be easy to
>>>>> pick
>>>>>> per se. I'm in doubts regarding " in queries. At least TO syntax
>>>> expects
>>>>> [
>>>>>> ]
>>>>>> You can start from these baseline cases
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>> https://github.com/apache/lucene-solr/blob/master/solr/core/src/test/org/apache/solr/schema/DateRangeFieldTest.java
>>>>>> 
>>>>>> and check
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>> https://lucene.apache.org/solr/guide/8_0/working-with-dates.html#date-range-formatting
>>>>>> (also see below) for sure.
>>>>>> Also, I remember lack of strictness in 7,2.1 see
>>>>>> https://issues.apache.org/jira/browse/LUCENE-8640
>>>>>> 
>>>>>> On Fri, Jul 5, 2019 at 5:11 PM Steven White <sw...@gmail.com>
>>>>> wrote:
>>>>>> 
>>>>>>> Hi everyone,
>>>>>>> 
>>>>>>> I'm using Solr 7.2.1 but can upgrade if I must.
>>>>>>> 
>>>>>>> I setup my schema like so:
>>>>>>> 
>>>>>>>   <fieldType name="dateRange" class="solr.DateRangeField"/>
>>>>>>>   <field name="CC_FILE_DATETIME"   type="dateRange"
>>>>> indexed="true"
>>>>>>> required="true"    stored="false"  multiValued="false" />
>>>>>>> 
>>>>>>> And indexed my data like so:
>>>>>>> 
>>>>>>>   doc.addField("CC_FILE_DATETIME", "2019-02-05T12:04:00Z");;
>>>>>>> 
>>>>>>> When I try to search against this field, some search are working,
>>>>> others
>>>>>>> are not.  Here are examples
>>>>>>> 
>>>>>>>   I get a hit: CC_FILE_DATETIME:"2019-02-05"
>>>>>>>   I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12"
>>>>>>>   I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04"
>>>>>>>   I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04:00Z"
>>>>>>> 
>>>>>>> I'm seeing issues with range search took, like so:
>>>>>>> 
>>>>>>>   I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04 TO
>>>>>>> 2019-02-06:12:00"
>>>>>>> 
>>>>>>> It looks to me that anytime I include the time part, it won't work
>>>> and
>>>>>> yes
>>>>>>> I tried escaping ":" like so "\:" but that didn't help.
>>>>>>> 
>>>>>>> Can someone guide me through this?
>>>>>>> 
>>>>>>> Thank you
>>>>>>> 
>>>>>>> Steven
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Sincerely yours
>>>>>> Mikhail Khludnev
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> Sincerely yours
>>>> Mikhail Khludnev
>>>> 
>> 
>> 


Re: Searching on dates and time

Posted by Steven White <sw...@gmail.com>.
Achieving the use-case is a must.  So if here is an alternative to
using solr.DateRangeField,
I'm willing to use it.  What do you mean by "pdate" and what is it?

I'm reading this link on how to use DateRangeField but yet it is not
working for me:
https://lucene.apache.org/solr/guide/6_6/working-with-dates.html  Is the
issue with my schema the way i set it up?  The way I'm indexing the data?
Or something else?

Steven

On Fri, Jul 5, 2019 at 3:03 PM Erick Erickson <er...@gmail.com>
wrote:

> I think what Mikhail is asking is whether your use-case would be satisfied
> by just indexing a standard pdate rather than a daterange, then querying
> by
>
> fq=CC_FILE_DATETIME:[some_date/MONTH TO some_maybe_other_full_date].
>
> With regular pdates, you can use “date math” to round to whatever you want
> on one or both parts of the query.
>
> A note you might be interested in about “fq” clauses and dates in the
> filter cache:
>
> https://dzone.com/articles/solr-date-math-now-and-filter
>
> Best,
> Erick
>
> > On Jul 5, 2019, at 11:55 AM, Steven White <sw...@gmail.com> wrote:
> >
> > I need both: point in time and range.  In both cases, I need to be able
> to
> > search between just 2 years, between year-month to year-month-day-time,
> > etc.  So getting my schema right, what and how I index right and the
> search
> > syntax right are all important.  This is why, in my original post, I
> shared
> > my schema, what I'm indexing and search syntax I'm trying to use.  If I
> got
> > anything wrong here to get the feature working right, please let me know.
> >
> > Steven.
> >
> > On Fri, Jul 5, 2019 at 2:16 PM Mikhail Khludnev <mk...@apache.org> wrote:
> >
> >> Hold on. Do you need a range or just point in time?
> >>
> >> On Fri, Jul 5, 2019 at 6:51 PM Steven White <sw...@gmail.com>
> wrote:
> >>
> >>> Thanks Mikhail.  I will read those links and switch over to latest
> Solr.
> >>>
> >>> Just to be sure, my schema setup and the way I'm indexing the date data
> >> are
> >>> not the issue, right?
> >>>
> >>> Steven.
> >>>
> >>> On Fri, Jul 5, 2019 at 11:05 AM Mikhail Khludnev <mk...@apache.org>
> >> wrote:
> >>>
> >>>> Hello,
> >>>>
> >>>> The indexed daterange value is really narrow, it might not be easy to
> >>> pick
> >>>> per se. I'm in doubts regarding " in queries. At least TO syntax
> >> expects
> >>> [
> >>>> ]
> >>>> You can start from these baseline cases
> >>>>
> >>>>
> >>>
> >>
> https://github.com/apache/lucene-solr/blob/master/solr/core/src/test/org/apache/solr/schema/DateRangeFieldTest.java
> >>>>
> >>>> and check
> >>>>
> >>>>
> >>>
> >>
> https://lucene.apache.org/solr/guide/8_0/working-with-dates.html#date-range-formatting
> >>>> (also see below) for sure.
> >>>> Also, I remember lack of strictness in 7,2.1 see
> >>>> https://issues.apache.org/jira/browse/LUCENE-8640
> >>>>
> >>>> On Fri, Jul 5, 2019 at 5:11 PM Steven White <sw...@gmail.com>
> >>> wrote:
> >>>>
> >>>>> Hi everyone,
> >>>>>
> >>>>> I'm using Solr 7.2.1 but can upgrade if I must.
> >>>>>
> >>>>> I setup my schema like so:
> >>>>>
> >>>>>    <fieldType name="dateRange" class="solr.DateRangeField"/>
> >>>>>    <field name="CC_FILE_DATETIME"   type="dateRange"
> >>> indexed="true"
> >>>>> required="true"    stored="false"  multiValued="false" />
> >>>>>
> >>>>> And indexed my data like so:
> >>>>>
> >>>>>    doc.addField("CC_FILE_DATETIME", "2019-02-05T12:04:00Z");;
> >>>>>
> >>>>> When I try to search against this field, some search are working,
> >>> others
> >>>>> are not.  Here are examples
> >>>>>
> >>>>>    I get a hit: CC_FILE_DATETIME:"2019-02-05"
> >>>>>    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12"
> >>>>>    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04"
> >>>>>    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04:00Z"
> >>>>>
> >>>>> I'm seeing issues with range search took, like so:
> >>>>>
> >>>>>    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04 TO
> >>>>> 2019-02-06:12:00"
> >>>>>
> >>>>> It looks to me that anytime I include the time part, it won't work
> >> and
> >>>> yes
> >>>>> I tried escaping ":" like so "\:" but that didn't help.
> >>>>>
> >>>>> Can someone guide me through this?
> >>>>>
> >>>>> Thank you
> >>>>>
> >>>>> Steven
> >>>>>
> >>>>
> >>>>
> >>>> --
> >>>> Sincerely yours
> >>>> Mikhail Khludnev
> >>>>
> >>>
> >>
> >>
> >> --
> >> Sincerely yours
> >> Mikhail Khludnev
> >>
>
>

Re: Searching on dates and time

Posted by Erick Erickson <er...@gmail.com>.
I think what Mikhail is asking is whether your use-case would be satisfied
by just indexing a standard pdate rather than a daterange, then querying
by 

fq=CC_FILE_DATETIME:[some_date/MONTH TO some_maybe_other_full_date].

With regular pdates, you can use “date math” to round to whatever you want
on one or both parts of the query.

A note you might be interested in about “fq” clauses and dates in the
filter cache:

https://dzone.com/articles/solr-date-math-now-and-filter

Best,
Erick

> On Jul 5, 2019, at 11:55 AM, Steven White <sw...@gmail.com> wrote:
> 
> I need both: point in time and range.  In both cases, I need to be able to
> search between just 2 years, between year-month to year-month-day-time,
> etc.  So getting my schema right, what and how I index right and the search
> syntax right are all important.  This is why, in my original post, I shared
> my schema, what I'm indexing and search syntax I'm trying to use.  If I got
> anything wrong here to get the feature working right, please let me know.
> 
> Steven.
> 
> On Fri, Jul 5, 2019 at 2:16 PM Mikhail Khludnev <mk...@apache.org> wrote:
> 
>> Hold on. Do you need a range or just point in time?
>> 
>> On Fri, Jul 5, 2019 at 6:51 PM Steven White <sw...@gmail.com> wrote:
>> 
>>> Thanks Mikhail.  I will read those links and switch over to latest Solr.
>>> 
>>> Just to be sure, my schema setup and the way I'm indexing the date data
>> are
>>> not the issue, right?
>>> 
>>> Steven.
>>> 
>>> On Fri, Jul 5, 2019 at 11:05 AM Mikhail Khludnev <mk...@apache.org>
>> wrote:
>>> 
>>>> Hello,
>>>> 
>>>> The indexed daterange value is really narrow, it might not be easy to
>>> pick
>>>> per se. I'm in doubts regarding " in queries. At least TO syntax
>> expects
>>> [
>>>> ]
>>>> You can start from these baseline cases
>>>> 
>>>> 
>>> 
>> https://github.com/apache/lucene-solr/blob/master/solr/core/src/test/org/apache/solr/schema/DateRangeFieldTest.java
>>>> 
>>>> and check
>>>> 
>>>> 
>>> 
>> https://lucene.apache.org/solr/guide/8_0/working-with-dates.html#date-range-formatting
>>>> (also see below) for sure.
>>>> Also, I remember lack of strictness in 7,2.1 see
>>>> https://issues.apache.org/jira/browse/LUCENE-8640
>>>> 
>>>> On Fri, Jul 5, 2019 at 5:11 PM Steven White <sw...@gmail.com>
>>> wrote:
>>>> 
>>>>> Hi everyone,
>>>>> 
>>>>> I'm using Solr 7.2.1 but can upgrade if I must.
>>>>> 
>>>>> I setup my schema like so:
>>>>> 
>>>>>    <fieldType name="dateRange" class="solr.DateRangeField"/>
>>>>>    <field name="CC_FILE_DATETIME"   type="dateRange"
>>> indexed="true"
>>>>> required="true"    stored="false"  multiValued="false" />
>>>>> 
>>>>> And indexed my data like so:
>>>>> 
>>>>>    doc.addField("CC_FILE_DATETIME", "2019-02-05T12:04:00Z");;
>>>>> 
>>>>> When I try to search against this field, some search are working,
>>> others
>>>>> are not.  Here are examples
>>>>> 
>>>>>    I get a hit: CC_FILE_DATETIME:"2019-02-05"
>>>>>    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12"
>>>>>    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04"
>>>>>    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04:00Z"
>>>>> 
>>>>> I'm seeing issues with range search took, like so:
>>>>> 
>>>>>    I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04 TO
>>>>> 2019-02-06:12:00"
>>>>> 
>>>>> It looks to me that anytime I include the time part, it won't work
>> and
>>>> yes
>>>>> I tried escaping ":" like so "\:" but that didn't help.
>>>>> 
>>>>> Can someone guide me through this?
>>>>> 
>>>>> Thank you
>>>>> 
>>>>> Steven
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> Sincerely yours
>>>> Mikhail Khludnev
>>>> 
>>> 
>> 
>> 
>> --
>> Sincerely yours
>> Mikhail Khludnev
>> 


Re: Searching on dates and time

Posted by Steven White <sw...@gmail.com>.
I need both: point in time and range.  In both cases, I need to be able to
search between just 2 years, between year-month to year-month-day-time,
etc.  So getting my schema right, what and how I index right and the search
syntax right are all important.  This is why, in my original post, I shared
my schema, what I'm indexing and search syntax I'm trying to use.  If I got
anything wrong here to get the feature working right, please let me know.

Steven.

On Fri, Jul 5, 2019 at 2:16 PM Mikhail Khludnev <mk...@apache.org> wrote:

> Hold on. Do you need a range or just point in time?
>
> On Fri, Jul 5, 2019 at 6:51 PM Steven White <sw...@gmail.com> wrote:
>
> > Thanks Mikhail.  I will read those links and switch over to latest Solr.
> >
> > Just to be sure, my schema setup and the way I'm indexing the date data
> are
> > not the issue, right?
> >
> > Steven.
> >
> > On Fri, Jul 5, 2019 at 11:05 AM Mikhail Khludnev <mk...@apache.org>
> wrote:
> >
> > > Hello,
> > >
> > > The indexed daterange value is really narrow, it might not be easy to
> > pick
> > > per se. I'm in doubts regarding " in queries. At least TO syntax
> expects
> > [
> > > ]
> > > You can start from these baseline cases
> > >
> > >
> >
> https://github.com/apache/lucene-solr/blob/master/solr/core/src/test/org/apache/solr/schema/DateRangeFieldTest.java
> > >
> > > and check
> > >
> > >
> >
> https://lucene.apache.org/solr/guide/8_0/working-with-dates.html#date-range-formatting
> > > (also see below) for sure.
> > > Also, I remember lack of strictness in 7,2.1 see
> > > https://issues.apache.org/jira/browse/LUCENE-8640
> > >
> > > On Fri, Jul 5, 2019 at 5:11 PM Steven White <sw...@gmail.com>
> > wrote:
> > >
> > > > Hi everyone,
> > > >
> > > > I'm using Solr 7.2.1 but can upgrade if I must.
> > > >
> > > > I setup my schema like so:
> > > >
> > > >     <fieldType name="dateRange" class="solr.DateRangeField"/>
> > > >     <field name="CC_FILE_DATETIME"   type="dateRange"
> > indexed="true"
> > > > required="true"    stored="false"  multiValued="false" />
> > > >
> > > > And indexed my data like so:
> > > >
> > > >     doc.addField("CC_FILE_DATETIME", "2019-02-05T12:04:00Z");;
> > > >
> > > > When I try to search against this field, some search are working,
> > others
> > > > are not.  Here are examples
> > > >
> > > >     I get a hit: CC_FILE_DATETIME:"2019-02-05"
> > > >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12"
> > > >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04"
> > > >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04:00Z"
> > > >
> > > > I'm seeing issues with range search took, like so:
> > > >
> > > >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04 TO
> > > > 2019-02-06:12:00"
> > > >
> > > > It looks to me that anytime I include the time part, it won't work
> and
> > > yes
> > > > I tried escaping ":" like so "\:" but that didn't help.
> > > >
> > > > Can someone guide me through this?
> > > >
> > > > Thank you
> > > >
> > > > Steven
> > > >
> > >
> > >
> > > --
> > > Sincerely yours
> > > Mikhail Khludnev
> > >
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: Searching on dates and time

Posted by Mikhail Khludnev <mk...@apache.org>.
Hold on. Do you need a range or just point in time?

On Fri, Jul 5, 2019 at 6:51 PM Steven White <sw...@gmail.com> wrote:

> Thanks Mikhail.  I will read those links and switch over to latest Solr.
>
> Just to be sure, my schema setup and the way I'm indexing the date data are
> not the issue, right?
>
> Steven.
>
> On Fri, Jul 5, 2019 at 11:05 AM Mikhail Khludnev <mk...@apache.org> wrote:
>
> > Hello,
> >
> > The indexed daterange value is really narrow, it might not be easy to
> pick
> > per se. I'm in doubts regarding " in queries. At least TO syntax expects
> [
> > ]
> > You can start from these baseline cases
> >
> >
> https://github.com/apache/lucene-solr/blob/master/solr/core/src/test/org/apache/solr/schema/DateRangeFieldTest.java
> >
> > and check
> >
> >
> https://lucene.apache.org/solr/guide/8_0/working-with-dates.html#date-range-formatting
> > (also see below) for sure.
> > Also, I remember lack of strictness in 7,2.1 see
> > https://issues.apache.org/jira/browse/LUCENE-8640
> >
> > On Fri, Jul 5, 2019 at 5:11 PM Steven White <sw...@gmail.com>
> wrote:
> >
> > > Hi everyone,
> > >
> > > I'm using Solr 7.2.1 but can upgrade if I must.
> > >
> > > I setup my schema like so:
> > >
> > >     <fieldType name="dateRange" class="solr.DateRangeField"/>
> > >     <field name="CC_FILE_DATETIME"   type="dateRange"
> indexed="true"
> > > required="true"    stored="false"  multiValued="false" />
> > >
> > > And indexed my data like so:
> > >
> > >     doc.addField("CC_FILE_DATETIME", "2019-02-05T12:04:00Z");;
> > >
> > > When I try to search against this field, some search are working,
> others
> > > are not.  Here are examples
> > >
> > >     I get a hit: CC_FILE_DATETIME:"2019-02-05"
> > >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12"
> > >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04"
> > >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04:00Z"
> > >
> > > I'm seeing issues with range search took, like so:
> > >
> > >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04 TO
> > > 2019-02-06:12:00"
> > >
> > > It looks to me that anytime I include the time part, it won't work and
> > yes
> > > I tried escaping ":" like so "\:" but that didn't help.
> > >
> > > Can someone guide me through this?
> > >
> > > Thank you
> > >
> > > Steven
> > >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> >
>


-- 
Sincerely yours
Mikhail Khludnev

Re: Searching on dates and time

Posted by Steven White <sw...@gmail.com>.
Thanks Mikhail.  I will read those links and switch over to latest Solr.

Just to be sure, my schema setup and the way I'm indexing the date data are
not the issue, right?

Steven.

On Fri, Jul 5, 2019 at 11:05 AM Mikhail Khludnev <mk...@apache.org> wrote:

> Hello,
>
> The indexed daterange value is really narrow, it might not be easy to pick
> per se. I'm in doubts regarding " in queries. At least TO syntax expects [
> ]
> You can start from these baseline cases
>
> https://github.com/apache/lucene-solr/blob/master/solr/core/src/test/org/apache/solr/schema/DateRangeFieldTest.java
>
> and check
>
> https://lucene.apache.org/solr/guide/8_0/working-with-dates.html#date-range-formatting
> (also see below) for sure.
> Also, I remember lack of strictness in 7,2.1 see
> https://issues.apache.org/jira/browse/LUCENE-8640
>
> On Fri, Jul 5, 2019 at 5:11 PM Steven White <sw...@gmail.com> wrote:
>
> > Hi everyone,
> >
> > I'm using Solr 7.2.1 but can upgrade if I must.
> >
> > I setup my schema like so:
> >
> >     <fieldType name="dateRange" class="solr.DateRangeField"/>
> >     <field name="CC_FILE_DATETIME"   type="dateRange"      indexed="true"
> > required="true"    stored="false"  multiValued="false" />
> >
> > And indexed my data like so:
> >
> >     doc.addField("CC_FILE_DATETIME", "2019-02-05T12:04:00Z");;
> >
> > When I try to search against this field, some search are working, others
> > are not.  Here are examples
> >
> >     I get a hit: CC_FILE_DATETIME:"2019-02-05"
> >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12"
> >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04"
> >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04:00Z"
> >
> > I'm seeing issues with range search took, like so:
> >
> >     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04 TO
> > 2019-02-06:12:00"
> >
> > It looks to me that anytime I include the time part, it won't work and
> yes
> > I tried escaping ":" like so "\:" but that didn't help.
> >
> > Can someone guide me through this?
> >
> > Thank you
> >
> > Steven
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: Searching on dates and time

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello,

The indexed daterange value is really narrow, it might not be easy to pick
per se. I'm in doubts regarding " in queries. At least TO syntax expects [
]
You can start from these baseline cases
https://github.com/apache/lucene-solr/blob/master/solr/core/src/test/org/apache/solr/schema/DateRangeFieldTest.java

and check
https://lucene.apache.org/solr/guide/8_0/working-with-dates.html#date-range-formatting
(also see below) for sure.
Also, I remember lack of strictness in 7,2.1 see
https://issues.apache.org/jira/browse/LUCENE-8640

On Fri, Jul 5, 2019 at 5:11 PM Steven White <sw...@gmail.com> wrote:

> Hi everyone,
>
> I'm using Solr 7.2.1 but can upgrade if I must.
>
> I setup my schema like so:
>
>     <fieldType name="dateRange" class="solr.DateRangeField"/>
>     <field name="CC_FILE_DATETIME"   type="dateRange"      indexed="true"
> required="true"    stored="false"  multiValued="false" />
>
> And indexed my data like so:
>
>     doc.addField("CC_FILE_DATETIME", "2019-02-05T12:04:00Z");;
>
> When I try to search against this field, some search are working, others
> are not.  Here are examples
>
>     I get a hit: CC_FILE_DATETIME:"2019-02-05"
>     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12"
>     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04"
>     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04:00Z"
>
> I'm seeing issues with range search took, like so:
>
>     I don't get a hit: CC_FILE_DATETIME:"2019-02-05T12:04 TO
> 2019-02-06:12:00"
>
> It looks to me that anytime I include the time part, it won't work and yes
> I tried escaping ":" like so "\:" but that didn't help.
>
> Can someone guide me through this?
>
> Thank you
>
> Steven
>


-- 
Sincerely yours
Mikhail Khludnev