Search code examples
c#azure-cognitive-search

Azure Search SDK 11 Wildcards


I'm trying to search with the .NET SDK V11 to find all names that start with JOHN. Fuzzy search works find, John~, as well as Contains, John. But if I pass John*. Nothing comes back. I've tried '?' instead. Same result.

var options = new SearchOptions
{
 QueryType = SearchQueryType.Full,
 IncludeTotalCount = true,
 Skip = criteria.Page * criteria.PageSize,
 Size = criteria.PageSize,
};


var searchResults = await client.SearchAsync<Result>("FirstName:JOHN*", options);

After looking at tons of documentation on the MS site, I'm not sure what else to try. It says it should work, as well as 'Jo*n', which doesn't seem to work either.


Solution

  • So I had to go with this solution below. Not sure why, it seems to contradict the MS documentation.

    Filter = "search.ismatch('/John.*/,','FirstName','full','all')"
    

    Works great though...