Sike12
Sike12

Reputation: 1262

Azure Search Filter search.ismatch function doesnt work with mixture of special characters like hiphen and single quote

I have a following code,

filter="search.ismatch('Paris\-l''Hopital*', 'DestinationAddress/City', 'full', 'all')" 

This filter should give me the record that has City with the name Paris-l'Hopital. Please note i am escaping the single quote in the middle of the search term with another single quote. Hiphen is escaped using backslash. Moreover the city field uses Microsoft Analyzer.

While i can see the record exists in the search index i cannot understand why this filter doesnt return the record i am expecting. Any input will be highly appreciated.

References https://learn.microsoft.com/en-us/azure/search/search-query-odata-full-text-search-functions https://learn.microsoft.com/en-us/azure/search/query-simple-syntax

Thank you

Upvotes: 0

Views: 1121

Answers (2)

Dan Gøran Lunde
Dan Gøran Lunde

Reputation: 5343

Normally, I would suggest considering a language-specific analyzer if you have content in a specific language. For addresses, this is tricky since you probably have to support all types of addresses. Have you tried using one of the French analyzers? It would probably do better at tokenizing typical French content.

Upvotes: 0

Thiago Custodio
Thiago Custodio

Reputation: 18387

By default it considers hyphen as a stopword. You need to change the default analyzer to not break into different words when it finds the '-'.

Upvotes: 2

Related Questions