Search code examples
azureazure-cognitive-searchazure-search-.net-sdk

Azure Search - SearchMode : ANY - not working as expected


Fields (All fields are filterable)

DocumentName : string
Document_types : ['type1','type2','type3']
Date : Date

I'm using .net library in order to make calls to Azure Search API.

Example A (ANY) - I want to get all the results where keyword is Text or Document_types is type1.

How would this work? below is the sample code which I'm using.

        var filters = new SearchParameters()
        {
            Filter = "document_types/any(t: search.in(t, 'type1'))",
            Skip = (1 - 1) * 99999999,
            Top = 99999999,
            IncludeTotalResultCount = true,
            OrderBy = new[] { "as_of_date desc" },
            HighlightFields = new[] { "Content" },
            HighlightPreTag = "<span class=\"search-highlight\">",
            HighlightPostTag = "</span>",
            QueryType = QueryType.Full,
            SearchMode = SearchMode.Any
        };
        var results = await indexClient.Documents.SearchAsync("/.*" + query + ".*/", filters);

Thanks in advance!


Solution

  • it worked with the use of search.ismatch('{0}')function.