Handling Special Characters in Typesense Queries
TLDR Jack had an issue with Typesense returning all results when querying with special characters. Jason indicated that Typesense removes special characters, suggesting a modification in the symbols_to_index
setting. Jack found a solution by implementing a client-side filter for special characters only queries.
Oct 17, 2023 (1 month ago)
Jack
04:37 PM@
), I seem to get all results back when I'd actually expect no results (none of my documents contain an @
). Is there an option to disable this behaviour? We depend on there being some highlight information in the results, but when searching for special characters we don't get any highlight data back (as the result doesn't actually match the query).Jason
04:38 PMq=@
will actually translate to q=*
by default.You want to add
@
to the symbols_to_index
setting when creating the collection, to change this behaviorJack
04:40 PM@
to symbols_to_index
as none of my results have @
in them (and I'd have to do it for every other special character too!) - ideally if a query consists entirely of non-indexed symbols then it should return nothing, but I understand treating it as *
. I'll implement something on our client-side to not send a query if it only consists of special characters.Jack
04:42 PMJack
04:43 PMTypesense
Indexed 3015 threads (79% resolved)
Similar Threads
Querying with Special Characters in Collections
Hariharan asked about querying with special characters. Kishore Nallan explained to use `symbols_to_index` configuration while creating the collection.
Handling Special Characters in Search Queries
Sidharth asks how to handle special characters in search queries. Kishore Nallan suggests using `symbols_to_index` configuration and provides an example to help.
Typesense Username Search Issue with Dashes or Underscores
Jonathan had issues with searching for usernames with dashes or underscores in Typesense. Kishore Nallan advised using the `symbols_to_index` parameter to index special characters.