#community-help

Handling Special Characters in Facets and Queries

TLDR Greg experienced issues with faceting on field values with special characters. Kishore Nallan suggested using the symbols_to_index configuration during collection creation to index the special characters.

Powered by Struct AI

1

Mar 13, 2023 (9 months ago)
Greg
Photo of md5-1ea63728effc51f48c3ffecdc8646553
Greg
01:09 PM
Facets returned on field ending with + or - chars are not working. For some reason, when I facet on a field with values (M+, M, M-, NM+, NM, NM-) I get back only 2 facets with one of the M values randomly and one of the NM values randomly. The counts group all the M values together and all the NM values together. Is there a way to escape characters when faceting so it treats them distinctly? Same issue when doing a query - “NM-” returns all the NM values.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:12 PM
Yes, please use the symbols_to_index configuration while creating the collection to enable indexing of those symbols.

{
        "name": "coll_name",
        "fields": [           
          {"name": "title", "type": "string"}
        ], "symbols_to_index": ["+"]
      }
Greg
Photo of md5-1ea63728effc51f48c3ffecdc8646553
Greg
01:13 PM
Thanks for the fast reply - Loving the product and support team!

1

01:22
Greg
01:22 PM
One follow-up: Update Schema in Cloud TS replies: Error: e: Request failed with HTTP code 400 | Server said: Only fields can be updated at the moment. Do I need to use API or other easier way to modify an existing schema?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:25 PM
You will have to recreate the collection, unfortunately.
01:26
Kishore Nallan
01:26 PM
Since this configuration affects all indexing of all fields, it is not easy to update it.
Greg
Photo of md5-1ea63728effc51f48c3ffecdc8646553
Greg
01:26 PM
Makes sense - I will do that. Update would be a nice future feature. Thank you once again.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:27 PM
Agreed