How to format odata string in python to query Azure Cognitive Search with azure.search.documents?

Viewed 41

I'm using azure.search.documents and I have a problem with string inside filter parameter. I created SearchClient and I want to use search() function on it to query Azure Cognitive Search. I wanted to use search.ismatch() odata syntax function inside filter parameter like below:

search_client.search(
...
filter="search.ismatch('/test.*/','testField','full','all')"
...
)

I know that syntax is correct because while testing in Azure Portal everything works, but while sending a request from program I am getting an error:

Message: Failed to parse query string at line 1, column 46. See https://aka.ms/azure-search-full-query for supported syntax.
Exception Details:      (InvalidSearchSyntax) Failed to parse query string at line 1, column 46. See https://aka.ms/azure-search-full-query for supported syntax.
        Code: InvalidSearchSyntax
        Message: Failed to parse query string at line 1, column 46. See https://aka.ms/azure-search-full-query for supported syntax.

I need to use filter parameter, so changing to search parameter won't solve my problem.

0 Answers
Related