Search code examples
azure-cognitive-search

Azure Search Using just a Filter without a search expression


How do you make a search in Azure Search using just a filter and no search expression.

The method indexClient.Documents.SearchAsync() requires a search expression and the SearchParameters object.

Many thanks


Solution

  • You can set the search expression to null or "*" to match all documents. This is in the SDK documentation:

    searchText

    Type: System.String

    A full-text search query expression; Use null or "*" to match all documents. See https://msdn.microsoft.com/library/azure/dn798920.aspx for more information about search query syntax.