Search code examples
azureazure-cognitive-search

Azure Search - Using double quotes in a search string


I have a requirement that my application should be able to search a string having a double quote in it. For example 22" Wood Log. Currently, searching for this string returns an error of query being failed.

I understand that using quotes like "abc" will give me results for only abc. But in the case of 22" Wood Log, the double quote represent inches and user may search like "22" Wood Log" expecting to see results for 22" Wood Log.

What are my options in current scenario to get some results? I hope my question is not too ambiguous.


Solution

  • The comment provided by Gaurav Mantri is correct. You should just escape the special characters in the search query with the backslash \ character.

    For more details and for reference about the querying syntax, please visit: https://learn.microsoft.com/en-us/rest/api/searchservice/lucene-query-syntax-in-azure-search

    (You particular query is answered under the Section: Escaping special characters)