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 Jeremy Smith <ja...@cornell.edu> on 2019/01/07 22:00:47 UTC

DateRangeField requires month?

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

Re: DateRangeField requires month?

Posted by Jeremy Smith <ja...@cornell.edu>.
Thanks Mikhail, I think the change you proposed to the documentation will be helpful to avoid this confusion.

________________________________
From: Mikhail Khludnev <mk...@apache.org>
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 <mk...@apache.org> 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 <ja...@cornell.edu> 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 <mk...@apache.org>
>> 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 <ja...@cornell.edu> 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

Re: DateRangeField requires month?

Posted by Mikhail Khludnev <mk...@apache.org>.
Follow up https://issues.apache.org/jira/browse/SOLR-13139

On Tue, Jan 15, 2019 at 2:46 PM Mikhail Khludnev <mk...@apache.org> 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 <ja...@cornell.edu> 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 <mk...@apache.org>
>> 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 <ja...@cornell.edu> 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

Re: DateRangeField requires month?

Posted by Mikhail Khludnev <mk...@apache.org>.
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 <ja...@cornell.edu> 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 <mk...@apache.org>
> 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 <ja...@cornell.edu> 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

Re: DateRangeField requires month?

Posted by Jeremy Smith <ja...@cornell.edu>.
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 <mk...@apache.org>
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 <ja...@cornell.edu> 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

Re: DateRangeField requires month?

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

See below.

On Mon, Jan 7, 2019 at 5:09 PM Jeremy Smith <ja...@cornell.edu> 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