Search code examples
azure-cognitive-search

Wildcard Syntax for Azure Search Simple Query Syntax


I am using the Azure Search C# SDK version 5.0.1. I am trying to perform a simple query that will search a field for a value that starts with something. It would be equivalent to the SQL query of Select * From mytable Where myproperty = 'val%'. According to the Simple Query Syntax documentation (located here) this should be possible using a wildcard. I cannot figure out how to get it working. I have tried to populate the Filter property of the SearchParameters in the following ways:

  1. "fieldname eq 'val*'" Doesn't work
  2. "fieldname eq 'val\.*'" Doesn't work
  3. "search.in(filename, 'val*')" Doesn't work

Does anyone know of a way to perform wildcard searches using Azure Search .NET SDK with simple query syntax?


Solution

  • Wildcards work in searches, not filters. You need to use it in the searchText parameter, not the Filter parameter.