DateRangeField requires month?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

DateRangeField requires month?

Jeremy Smith
Hello,

     I am trying to use the DateRangeField and ran into an interesting issue.  According to the documentation (https://lucene.apache.org/solr/guide/7_6/working-with-dates.html), these are both valid for the DateRangeField: 2000-11 and 2000-11T13.  I can confirm this is working in 7.6.  I would also expect to be able to use 2000T13, which would mean any time in the year 2000 between 1300 and 1400.  However, I get an error when trying to insert this value:


"error":{"metadata":

    ["error-class","org.apache.solr.common.SolrException","root-error-class","java.lang.NumberFormatException"],

    "msg":"ERROR: Error adding field 'dtRange'='2000T13' msg=Couldn't parse date because: Improperly formatted date: 2000T13","code":400

}


I am using 7.6 with a super simple schema containing only _version_ and a DateRangeField and there's nothing special in my solrconfig.xml.  Is this behavior expected?  Should I open a jira issue?


Thanks,

Jeremy
Reply | Threaded
Open this post in threaded view
|

Re: DateRangeField requires month?

Mikhail Khludnev-2
Hello, Jeremy.

See below.

On Mon, Jan 7, 2019 at 5:09 PM Jeremy Smith <[hidden email]> wrote:

> Hello,
>
>      I am trying to use the DateRangeField and ran into an interesting
> issue.  According to the documentation (
> https://lucene.apache.org/solr/guide/7_6/working-with-dates.html), these
> are both valid for the DateRangeField: 2000-11 and 2000-11T13.  I can
> confirm this is working in 7.6.  I would also expect to be able to use
> 2000T13, which would mean any time in the year 2000 between 1300 and 1400.


Nope. This is not a range, but multiple ranges. DateRangeField supports
contiguous ranges only.


> However, I get an error when trying to insert this value:
>
>
> "error":{"metadata":
>
>
> ["error-class","org.apache.solr.common.SolrException","root-error-class","java.lang.NumberFormatException"],
>
>     "msg":"ERROR: Error adding field 'dtRange'='2000T13' msg=Couldn't
> parse date because: Improperly formatted date: 2000T13","code":400
>
> }
>
>
> I am using 7.6 with a super simple schema containing only _version_ and a
> DateRangeField and there's nothing special in my solrconfig.xml.  Is this
> behavior expected?  Should I open a jira issue?
>
>
> Thanks,
>
> Jeremy
>


--
Sincerely yours
Mikhail Khludnev
Reply | Threaded
Open this post in threaded view
|

Re: DateRangeField requires month?

Jeremy Smith
Hi Mikhail, thanks for the response.  I'm probably missing something, but what makes 2000-11T13 contiguous and 2000T13 not contiguous?  They seem pretty similar to me, but only the former is supported.


Thanks,

Jeremy

________________________________
From: Mikhail Khludnev <[hidden email]>
Sent: Sunday, January 13, 2019 12:59:31 AM
To: solr-user
Subject: Re: DateRangeField requires month?

Hello, Jeremy.

See below.

On Mon, Jan 7, 2019 at 5:09 PM Jeremy Smith <[hidden email]> wrote:

> Hello,
>
>      I am trying to use the DateRangeField and ran into an interesting
> issue.  According to the documentation (
> https://lucene.apache.org/solr/guide/7_6/working-with-dates.html), these
> are both valid for the DateRangeField: 2000-11 and 2000-11T13.  I can
> confirm this is working in 7.6.  I would also expect to be able to use
> 2000T13, which would mean any time in the year 2000 between 1300 and 1400.


Nope. This is not a range, but multiple ranges. DateRangeField supports
contiguous ranges only.


> However, I get an error when trying to insert this value:
>
>
> "error":{"metadata":
>
>
> ["error-class","org.apache.solr.common.SolrException","root-error-class","java.lang.NumberFormatException"],
>
>     "msg":"ERROR: Error adding field 'dtRange'='2000T13' msg=Couldn't
> parse date because: Improperly formatted date: 2000T13","code":400
>
> }
>
>
> I am using 7.6 with a super simple schema containing only _version_ and a
> DateRangeField and there's nothing special in my solrconfig.xml.  Is this
> behavior expected?  Should I open a jira issue?
>
>
> Thanks,
>
> Jeremy
>


--
Sincerely yours
Mikhail Khludnev
Reply | Threaded
Open this post in threaded view
|

Re: DateRangeField requires month?

Mikhail Khludnev-2
I did some testing by tweaking DateRangeFieldTest and witness that
2000-11T13 is parsed as 2000-11-13 see
https://github.com/apache/lucene-solr/blob/f083473b891e596def2877b5429fcfa6db175464/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/DateRangePrefixTree.java#L462
Don't know what to do with it... At least I'm going to update the doc.

On Mon, Jan 14, 2019 at 4:42 PM Jeremy Smith <[hidden email]> wrote:

> Hi Mikhail, thanks for the response.  I'm probably missing something, but
> what makes 2000-11T13 contiguous and 2000T13 not contiguous?  They seem
> pretty similar to me, but only the former is supported.
>
>
> Thanks,
>
> Jeremy
>
> ________________________________
> From: Mikhail Khludnev <[hidden email]>
> Sent: Sunday, January 13, 2019 12:59:31 AM
> To: solr-user
> Subject: Re: DateRangeField requires month?
>
> Hello, Jeremy.
>
> See below.
>
> On Mon, Jan 7, 2019 at 5:09 PM Jeremy Smith <[hidden email]> wrote:
>
> > Hello,
> >
> >      I am trying to use the DateRangeField and ran into an interesting
> > issue.  According to the documentation (
> > https://lucene.apache.org/solr/guide/7_6/working-with-dates.html), these
> > are both valid for the DateRangeField: 2000-11 and 2000-11T13.  I can
> > confirm this is working in 7.6.  I would also expect to be able to use
> > 2000T13, which would mean any time in the year 2000 between 1300 and
> 1400.
>
>
> Nope. This is not a range, but multiple ranges. DateRangeField supports
> contiguous ranges only.
>
>
> > However, I get an error when trying to insert this value:
> >
> >
> > "error":{"metadata":
> >
> >
> >
> ["error-class","org.apache.solr.common.SolrException","root-error-class","java.lang.NumberFormatException"],
> >
> >     "msg":"ERROR: Error adding field 'dtRange'='2000T13' msg=Couldn't
> > parse date because: Improperly formatted date: 2000T13","code":400
> >
> > }
> >
> >
> > I am using 7.6 with a super simple schema containing only _version_ and a
> > DateRangeField and there's nothing special in my solrconfig.xml.  Is this
> > behavior expected?  Should I open a jira issue?
> >
> >
> > Thanks,
> >
> > Jeremy
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


--
Sincerely yours
Mikhail Khludnev
Reply | Threaded
Open this post in threaded view
|

Re: DateRangeField requires month?

Mikhail Khludnev-2
Follow up https://issues.apache.org/jira/browse/SOLR-13139

On Tue, Jan 15, 2019 at 2:46 PM Mikhail Khludnev <[hidden email]> wrote:

> I did some testing by tweaking DateRangeFieldTest and witness that
> 2000-11T13 is parsed as 2000-11-13 see
>
> https://github.com/apache/lucene-solr/blob/f083473b891e596def2877b5429fcfa6db175464/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/DateRangePrefixTree.java#L462
> Don't know what to do with it... At least I'm going to update the doc.
>
> On Mon, Jan 14, 2019 at 4:42 PM Jeremy Smith <[hidden email]> wrote:
>
>> Hi Mikhail, thanks for the response.  I'm probably missing something, but
>> what makes 2000-11T13 contiguous and 2000T13 not contiguous?  They seem
>> pretty similar to me, but only the former is supported.
>>
>>
>> Thanks,
>>
>> Jeremy
>>
>> ________________________________
>> From: Mikhail Khludnev <[hidden email]>
>> Sent: Sunday, January 13, 2019 12:59:31 AM
>> To: solr-user
>> Subject: Re: DateRangeField requires month?
>>
>> Hello, Jeremy.
>>
>> See below.
>>
>> On Mon, Jan 7, 2019 at 5:09 PM Jeremy Smith <[hidden email]> wrote:
>>
>> > Hello,
>> >
>> >      I am trying to use the DateRangeField and ran into an interesting
>> > issue.  According to the documentation (
>> > https://lucene.apache.org/solr/guide/7_6/working-with-dates.html),
>> these
>> > are both valid for the DateRangeField: 2000-11 and 2000-11T13.  I can
>> > confirm this is working in 7.6.  I would also expect to be able to use
>> > 2000T13, which would mean any time in the year 2000 between 1300 and
>> 1400.
>>
>>
>> Nope. This is not a range, but multiple ranges. DateRangeField supports
>> contiguous ranges only.
>>
>>
>> > However, I get an error when trying to insert this value:
>> >
>> >
>> > "error":{"metadata":
>> >
>> >
>> >
>> ["error-class","org.apache.solr.common.SolrException","root-error-class","java.lang.NumberFormatException"],
>> >
>> >     "msg":"ERROR: Error adding field 'dtRange'='2000T13' msg=Couldn't
>> > parse date because: Improperly formatted date: 2000T13","code":400
>> >
>> > }
>> >
>> >
>> > I am using 7.6 with a super simple schema containing only _version_ and
>> a
>> > DateRangeField and there's nothing special in my solrconfig.xml.  Is
>> this
>> > behavior expected?  Should I open a jira issue?
>> >
>> >
>> > Thanks,
>> >
>> > Jeremy
>> >
>>
>>
>> --
>> Sincerely yours
>> Mikhail Khludnev
>>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


--
Sincerely yours
Mikhail Khludnev
Reply | Threaded
Open this post in threaded view
|

Re: DateRangeField requires month?

Jeremy Smith
Thanks Mikhail, I think the change you proposed to the documentation will be helpful to avoid this confusion.

________________________________
From: Mikhail Khludnev <[hidden email]>
Sent: Tuesday, January 15, 2019 8:47:17 AM
To: solr-user
Subject: Re: DateRangeField requires month?

Follow up https://issues.apache.org/jira/browse/SOLR-13139

On Tue, Jan 15, 2019 at 2:46 PM Mikhail Khludnev <[hidden email]> wrote:

> I did some testing by tweaking DateRangeFieldTest and witness that
> 2000-11T13 is parsed as 2000-11-13 see
>
> https://github.com/apache/lucene-solr/blob/f083473b891e596def2877b5429fcfa6db175464/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/DateRangePrefixTree.java#L462
> Don't know what to do with it... At least I'm going to update the doc.
>
> On Mon, Jan 14, 2019 at 4:42 PM Jeremy Smith <[hidden email]> wrote:
>
>> Hi Mikhail, thanks for the response.  I'm probably missing something, but
>> what makes 2000-11T13 contiguous and 2000T13 not contiguous?  They seem
>> pretty similar to me, but only the former is supported.
>>
>>
>> Thanks,
>>
>> Jeremy
>>
>> ________________________________
>> From: Mikhail Khludnev <[hidden email]>
>> Sent: Sunday, January 13, 2019 12:59:31 AM
>> To: solr-user
>> Subject: Re: DateRangeField requires month?
>>
>> Hello, Jeremy.
>>
>> See below.
>>
>> On Mon, Jan 7, 2019 at 5:09 PM Jeremy Smith <[hidden email]> wrote:
>>
>> > Hello,
>> >
>> >      I am trying to use the DateRangeField and ran into an interesting
>> > issue.  According to the documentation (
>> > https://lucene.apache.org/solr/guide/7_6/working-with-dates.html),
>> these
>> > are both valid for the DateRangeField: 2000-11 and 2000-11T13.  I can
>> > confirm this is working in 7.6.  I would also expect to be able to use
>> > 2000T13, which would mean any time in the year 2000 between 1300 and
>> 1400.
>>
>>
>> Nope. This is not a range, but multiple ranges. DateRangeField supports
>> contiguous ranges only.
>>
>>
>> > However, I get an error when trying to insert this value:
>> >
>> >
>> > "error":{"metadata":
>> >
>> >
>> >
>> ["error-class","org.apache.solr.common.SolrException","root-error-class","java.lang.NumberFormatException"],
>> >
>> >     "msg":"ERROR: Error adding field 'dtRange'='2000T13' msg=Couldn't
>> > parse date because: Improperly formatted date: 2000T13","code":400
>> >
>> > }
>> >
>> >
>> > I am using 7.6 with a super simple schema containing only _version_ and
>> a
>> > DateRangeField and there's nothing special in my solrconfig.xml.  Is
>> this
>> > behavior expected?  Should I open a jira issue?
>> >
>> >
>> > Thanks,
>> >
>> > Jeremy
>> >
>>
>>
>> --
>> Sincerely yours
>> Mikhail Khludnev
>>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


--
Sincerely yours
Mikhail Khludnev