#community-help

Querying with Special Characters in Collections

TLDR Hariharan asked about querying with special characters. Kishore Nallan explained to use symbols_to_index configuration while creating the collection.

Powered by Struct AI
3
7mo
Solved
Join the chat
Mar 14, 2023 (7 months ago)
Hariharan
Photo of md5-18c41204e6fd9bb8436d758a90a0e5ef
Hariharan
09:03 AM
Hi! Is it possible to query using special characters? Currently search query with only special characters results in showing all records. But expectation is not to return any data if no special characters in the field which we search.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
12:32 PM
Yes, please use symbols_to_index configuration while creating the collection.
12:33
Kishore Nallan
12:33 PM
curl -k "" -X POST -H "Content-Type: application/json" \                                                                                                                        
      -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
        "name": "coll_name",
        "fields": [           
          {"name": "title", "type": "string" }
        ], "symbols_to_index": ["+"]
      }'