#community-help

Faceting Museum Collections Data with TypeSense

TLDR Theodore sought advice on faceting museum collection data. Jason suggested converting dates to a Unix timestamp with lower granularity.

Powered by Struct AI
5
3mo
Solved
Join the chat
Sep 05, 2023 (3 months ago)
Theodore
Photo of md5-2f94b63d050dad6ced4a85316a658c61
Theodore
03:11 PM
#community-help I'm building a demonstrator project working with museum collections data. The data includes artefacts stretching from the present day through to deep time. Example data includes: -100000, -2100, 100, 1066, 1666, 1999-12-31, 2023-09-05... etc. that I'd like to facet. It would a be good UX to offer a slider/range filter for the end user. How would you approach this with TypeSense? Thank you for looking :-)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:58 PM
Interesting use-case! I'd usually recommend converting dates to Unix timestamps, but that might be too large of a number for -100000 year for eg!

May be you'd have to use a lower granularity equivalent of Unix timestamp, where each integer represents a day of the year may be?
03:58
Jason
03:58 PM
Then you can do a range filter on that numeric field
03:59
Jason
03:59 PM
So for eg, just like Unix timesamp 1970-01-01 would be represented as 0, but then 1970-01-02 would be 1
03:59
Jason
03:59 PM
And 1969-12-31 would be represented as -1, etc