lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <>
Subject Re: Range faceting on timestamp field
Date Thu, 24 Dec 2020 22:31:15 GMT
Then you need to form your start at relative to your timezone.

What I’d actually recommend is that if you need to bucket by day,
you index the day in a separate field. Of course, if you have to
bucket by day in arbitrary timezones that won’t work…..


> On Dec 24, 2020, at 4:42 PM, ufuk yılmaz <> wrote:
> Hello all,
> I have a plong field in my schema representing a Unix timestamp
> <field name="timestamp_s" type="plong" indexed="true"/>
> I’m doing a range facet over this field to find which event occured on which day. I’m
setting “start” on some date at 00:00 o’clock, end on another, and setting gap to 86400
(total seconds in a day)
> ...
> "type": "range",
> "field": "timestamp_s",
> "start": 1338498000,
> "end": 1339275600,
> "gap": 86400,
> ...
> Lets say that an event occured at 19:00 GMT+00. This facet puts it in the bucket of that
day, which starts at 00:00. I’m living in GMT+2 timezone, so clock was 21:00 and that event
occured on the same day with me, which is all good and correct.
> Another event occured at 23:00 GMT+00, Day 2. At that time, it was 01:00 Day 3 here.
Faceting puts the event at Day 2 00:00’s bucket, when converted to my timezone, puts the
event on Day 2. But it was Day 3 here when the event happened...
> I wish I didn’t bore the hell out of you. Do you have any suggestion to solve this
problem? Unfortunately my timestamp field is not a date field and I need to show the results
from my perspective, not from the universal time.
> Have a nice day!
> Sent from Mail for Windows 10

View raw message