Handling Special Characters in Search Queries
TLDR Sidharth asks how to handle special characters in search queries. Kishore Nallan suggests using symbols_to_index
configuration and provides an example to help.
1
May 25, 2023 (6 months ago)
Sidharth
10:59 AMIs there a way to not pre-process the special characters during search?
Got miss-match while searching a query (
a&b
) in the documents where one document actually contained the queried stringKishore Nallan
11:06 AMKishore Nallan
11:07 AMsymbols_to_index
configuration while creating collection.Sidharth
12:41 PMhttps://typesense.org/docs/0.23.1/api/collections.html#schema-parameters
Kishore Nallan
12:43 PMcurl -k "" -X POST -H "Content-Type: application/json" \ -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
"name": "docs",
"fields": [
{"name": "title", "type": "string" },
{"name": "points", "type": "int32" }
], "symbols_to_index": ["&"]
}'
Sidharth
12:44 PMWe'll try this, thanks
1
Typesense
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 Typesense Queries
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.
Implementing Directory-Specific Search with Typesense
M inquired about doing directory-specific searches using Typesense. Dima suggested storing all path combinations and using it in array filter. Kishore Nallan provided additional Typesense configuration advice to index special characters. M found these solutions helpful.