#community-help

Float Field Type and Auto Schema Detection Issue in Typesense

TLDR em1nos had problem with auto detection of float field type in Typesense. Jason confirmed and suggested setting the field type explicitly to float.

Powered by Struct AI
4
14mo
Solved
Join the chat
Jul 17, 2022 (14 months ago)
em1nos
Photo of md5-f33ae8b829901656b655c985c894be3a
em1nos
08:21 PM
I'm having an issue with float field type and auto schema detection . It seems that if the first document (that decides the field type with auto schema detection) has a float value with no decimals, it will set the field type to int64 instead. Is this correct and if so is there a solution? I'm using PHP (Laravel) to send the data to Typesense.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:07 PM
Yeah this is expected. Field type is determined by the value sent in the first doc.
09:08
Jason
09:08 PM
You would have to explicitly set the field type to float instead of using schema detection for just that field
em1nos
Photo of md5-f33ae8b829901656b655c985c894be3a
em1nos
09:10 PM
ok, thank you