lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: Date & Time datatypes?
Date Mon, 30 Mar 2015 17:42:29 GMT
Hmmm, not OOB. You could index two tdate fields though and in the
second one only index seconds into the day and index the other with
date math (i.e. /DAY) to normalize them. Or a tdate field with just a
long field for the seconds.

You could then use the range faceting to, say, put the docs into hour
buckets, and your time:[17:00 TO 18:00] would turn into something like
time:[61200 TO 64800]. A bit awkward I'll admit, but probably easier
than a custom field type. Or add a field for hours if that fits the
use-case.

FWIW,
Erick

On Mon, Mar 30, 2015 at 4:11 AM, Bram Van Dam <bram.vandam@intix.eu> wrote:
> Howdy folks,
>
> Is there any way index only the date and time portions of a datetime field?
>
> A Date is really a period of 24hrs, starting at 00:00 in said date's time
> zone. It would be useful if there was a way to search for documents of a
> certain date with these semantics.
>
> As for times, I'd like to be able to do queries like time:[17:00 TO 18:00].
> I suppose I could accomplish that by resetting the date portion to some
> bogus value, but then my facet/range values will contain that bogus date.
>
> I suppose the alternative is to create my own data types. Extending
> PrimitiveFieldType doesn't seem too hairy but maybe I'm overlooking some of
> the complexity...
>
> Thanks a bunch,
>
>  - Bram

Mime
View raw message