performant-software / core-data-cloud

Core Data. In the Cloud.
0 stars 1 forks source link

Numeric fields are indexed as strings #212

Open camdendotlol opened 6 months ago

camdendotlol commented 6 months ago

This is an issue I noticed while working on the La Supplique date slider, which expects the day/month/year to be numbers. It appears that numeric data indexed into Typesense using the typesense:index task is given a type of string in the index.

The affected fields on La Supplique are Day (d730b602-4b17-4296-a606-50be06e58243), month (3d3bf3b2-4595-4b5a-822c-7dd53e404453), and year (9e44bb3f-91ea-4602-8a35-cb2df6202f95).

Blocker for https://github.com/performant-software/sapientia-web-astro/issues/2

jamiefolsom commented 2 months ago

Hey @dleadbetter -- what are your thoughts on this issue? We'd like to be able to add a date facet to some of the Sapientia search UIs. cc @camdendotlol

dleadbetter commented 2 months ago

Hey @dleadbetter -- what are your thoughts on this issue? We'd like to be able to add a date facet to some of the Sapientia search UIs. cc @camdendotlol

@jamiefolsom - Yes, definitely something I think we should do. This issue not only affects the "Number" user-defined field types, but also "Boolean", "Date", and "Select". During the indexing process, we should convert the values from String to the appropriate type based on the user-defined field type (e.g. "Date" types are converted to Unix timestamps):

https://typesense.org/docs/26.0/api/collections.html#notes-on-indexing-common-types-of-data

jamiefolsom commented 2 months ago

@dleadbetter: Let's do this. Let me know when you're ready, and I can provide some more guidance.