#community-help

Typesense Non-String Field Query Workarounds

TLDR Carl seeks advice on querying non-string fields in Typesense. Kishore Nallan suggests using a string version, and Jason proposes the string* data type. Carl is considering these options.

Powered by Struct AI

2

5
21mo
Solved
Join the chat
Jan 21, 2022 (22 months ago)
Carl
Photo of md5-b4b5ae6f21ade3ef3d7824c4b63090c3
Carl
08:48 AM
Hey guys 🙂 Do any of you know if this would be possible (in the current release) at all? Query by non-string fields: https://github.com/typesense/typesense/issues/490
08:50
Carl
08:50 AM
We'd like to avoid the need of parsing in a string as an int on the consumer side.

One workaround we think could work, is to have some top level properties which are solely used for searching on. Then have some kind of "payload" property to store the contents in the correct data form.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:43 AM
Only string type can be queried upon. If you need to do that for a numerical field, you need to have a string version as well.

1

Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
02:11 PM
There’s also the string* data type which will automatically convert the int to string when storing in Typesense

1

Jan 24, 2022 (21 months ago)
Carl
Photo of md5-b4b5ae6f21ade3ef3d7824c4b63090c3
Carl
09:14 AM
Cheers guys, will have a look into the string* , otherwise will go with the workaround I mentioned