1
votes

I've been on the Microsoft Docs page relating to this topic for a long time. I keep reading the document and the comments and can't find the correct syntax for my query.

I have a document that has a PrimaryUnitTypeId field which is of type Edm.Int32. I would like to filter the documents that are returned by that field and would like to use multiple values at once. I am utilizing that .NET Client library as well as the search explorer in the Azure Portal.

My query works if the filter is as follows: (PrimaryUnitTypeId eq 1 or PrimaryUnitTypeId eq 2)

One of the notes on the top of the documentation page though states that this is the sub-optimal way to approach this problem and the search.in function should be used instead.

I have tried to switch my filter to search.in(PrimaryUnitTypeId, '1,2') or search.in(PrimaryUnitTypeId, '1,2', ',') which seems to be the correct syntax according to the documentation, but I keep receiving the following error:

Invalid expression: No function signature for the function with name 'search.in' matches the specified arguments. The function signatures considered are: search.in(Edm.String, Edm.String, Edm.String); search.in(Edm.String, Edm.String).\r\nParameter name: $filter

I have tried utilizing the 2016-09-01 and 2016-09-01-Preview versions of the API all to no avail.

How do I need to modify the above filter to get Azure Search to recognize and apply the filter?

1

1 Answers

2
votes

The search.in function currently only supports fields of type Edm.String. You can make this scenario work by adding a new string field and populating it with your integer data, or by changing the type of the PrimaryUnitTypeId field and recreating/repopulating your index.