1

I am using Azure Search Service for a Web API. Can anyone help me in passing filterquery to the search service with multiple filter options using c#. (OData with multiple filters). Exact requirement: When filters applied in search results, the results should be displayed relevant to filters and Vice versa.

I tried:

string searchServiceEndPoint = configuration["AzureSearchService:SearchServiceEndPoint"]; string queryApiKey configuration["AzureSearchService:SearchServiceQueryApiKey"]; SearchClient searchClient = new SearchClient(new Uri(searchServiceEndPoint), indexName, new AzureKeyCredential(queryApiKey));

    SearchOptions options = new SearchOptions()
    {
        IncludeTotalCount = true,
        Filter = Filter = "SalesPlay eq '" + filterQuery["SalesPlay"] + "' And EventPrimaryLanguage eq '" + filterQuery["EventPrimaryLanguage"] + "' And EventStatus eq '" + filterQuery["EventStatus"] + "'"
    };

    var results = searchClient.Search<Azureview>("Local", options);

1 Answers1

0

You're missing the SearchFilter.Create method.

You can refer also to this older post for an example and links: DotNet Core Azure Search SDK - filtering results