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);
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.