#community-help

Issue with Special Characters in Facet Names

TLDR arif faced a problem with special characters, specifically colons, in facet names. Kishore Nallan advised using a-zA-Z0-9_ as the safest subset and confirmed no workaround for field names.

Powered by Struct AI
May 17, 2023 (7 months ago)
arif
Photo of md5-e08256d678064813deb604fdf86f0867
arif
09:18 AM
Hi, I'm facing an issue with special characters in the facet names. The target facet is defined by a wildcard in the schema.
The issue is when the dynamic portion of the facet-name contains a colon, :. For example: prefix.a:b. Then if I try to use filter_by on it like prefix.a:b:=c it gives an error like "Could not find a filter field named prefix.a in the schema.". Now the questions
1. Is there any way to overcome this issue? Note: I'm using the Typesense Instantsearch Adapter in the front-end
2. Is there a way to know which special characters I should be aware about?
Thanks!
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:21 AM
Backticks work only for string literals in the filter value. You can try doing url encoding of the facet names.
09:21
Kishore Nallan
09:21 AM
In this case encoded form will be prefix.a%3Ab
09:21
Kishore Nallan
09:21 AM
But wait, this might not work as well, because : is used to split the field name from value.
09:22
Kishore Nallan
09:22 AM
If you stick to a-zA-Z0-9_ that's the safest subset.
09:22
Kishore Nallan
09:22 AM
No workaround for now for field names.
arif
Photo of md5-e08256d678064813deb604fdf86f0867
arif
09:25 AM
Okay. Thanks a lot for the help! 🙂
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:29 AM
No problem!