0
votes

I am using the latest Microsoft.Azure.Search SDK with the following search parameters. I have filter ID's that are MFR-1, MFR-2, MFR-3, etc. I am trying to bring back ANY record that has Filter ID that starts with MFR.

It seems that this should be simple query, but I am not finding a way to make this work with the SDK.

var Params = new SearchParameters()
{
    SearchMode = SearchMode.Any,
    QueryType = QueryType.Full,
    Top = 72,
    Skip = 0,
    IncludeTotalResultCount = true,
    Filter = "FilterIDs/any(c: c eq 'MFR-57')",
    OrderBy = new List<string> { "Sort", "Title"},
    Facets = new List<string>() { "Filters,count:500,sort:value" }
};

Data looks like this:

{
"id": "691",
"RecordType": "product",
"FilterIDs": [
    "MFR-106",
    "36-250",
    "36-265"
],
}

I've tried this, but it doesn't appear to work with arrays as the title would suggest.

Contains / in array in Azure Search (Preview)

1

1 Answers

0
votes

Per my understanding , you are looking for a filter express that could filter all record whose FilterIDs string collection(array) contains item value started with "MFR" .

As official doc indicated :

Inside lambda expressions for string collections, the only comparison operators that can be used are eq and ne.

So I am afraid there is no way to do fuzzy search here.

But if your filter ids are enumerable , maybe you can use the filter express as below :

FilterIDs/any(c: c eq 'MFR-1') or FilterIDs/any(c: c eq 'MFR-2') or FilterIDs/any(c: c eq 'MFR-3') or ....

I think it would be a work around here, it works for me on my side . Hope it helps.