Hi @SAMANVITH M S
You're getting this error "Invalid expression: No function signature for the function with name 'contains' matches the specified arguments." because Azure Cognitive Search supports a subset of the OData protocol, and not all functions are available. The dayOfWeek
function is not supported in Azure Cognitive Search and the contains
function are not supported in $filter
expressions. You can learn more about Constants syntax in this Azure Document.
To apply advanced filters using OData functions in Azure Cognitive Search, you can use the search.in
function. This function allows you to specify a list of values to match against a field.
For example, if you have a field called DaysOfWeek
that contains a comma-separated list of days (e.g., "Mon,Tue,Wed"), you can use the following filter expression to find documents that contain "Mon":
$filter=search.in(DaysOfWeek, 'Mon', ',')
This will return all documents where the DaysOfWeek
field contains the value "Mon".
Similarly, you can use the search.in
function to filter documents based on multiple days:
$filter=search.in(DaysOfWeek, 'Mon,Tue', ',')
Keep in mind that the search.in function only works with string values, so you may need to convert your dates to strings before using this function. Also, the performance of the search may be affected by the complexity of the filter expressions. If you have a large dataset and complex filters, consider optimizing your search by using a more specific search schema, indexing only the necessary fields, and minimizing the number of filter expressions. Hope that helps. -Grace If the information helped address your question, please "Accept" the answer. This will help us and also improve searchability for others in the community who might be researching similar information.