0
votes

I would like to match two arrays with each other. Is that possible in Azure Search?

So i've got an index with an field, languages, of the the type DataType.Collection(DataType.String).

In the index is the following:

{
    "@odata.context": "",
    "value": [
        { id = 1, languages = ["nl","en","fr","de"] },
        { id = 2, languages = ["nl","de"] },
        { id = 3, languages = ["nl"] }
    ]
}

So now i want to filter the results. I've tried to use search.in(languages, 'fr,de', ',') and would expect to get 1 and 2 back. But I get the exception:

Invalid expression: The argument for an invocation of a function with name 'search.in' is not a single value. All arguments for this function must be single values. Parameter name: $filter

So how can i filter, in azure search, on an array with an other array.

1

1 Answers

0
votes

The answer is combining two functions. So you get the following function:

languages/any(l: search.in(l, 'fr,de', ','))

Then you compare two arrays and give back the ones that match one of the items in the array.