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 <erickerick...@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 <swhite4...@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 <m...@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 <swhite4...@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 <m...@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 <swhite4...@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 > >> > >