#community-help

Configuring Search for Cities with '-' Characters

TLDR gab asked how to configure search for cities with '-' characters. Kishore Nallan guided to define '-' as token_separators while creating the collection.

Powered by Struct AI

1

3
18mo
Solved
Join the chat
Apr 19, 2022 (18 months ago)
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
07:17 AM
Hi,
I have cities containing '-' characters like this one: 'Plan-les-ouates'.
How can I configure the search so I can found them when querying without the '-' like this: 'plan les ouates' ?
Thanks
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:22 AM
You have to define - as token_separators while creating the collection. E.g.

{
   "name":"docs",
   "token_separators":[
      "-"
   ],
   "fields":[
      {
         "name":"title",
         "type":"string"
      },
      {
         "name":"points",
         "type":"int32"
      }
   ]
}
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
07:25 AM
Ah perfect, works well, thanks!

1