Problem/Motivation

When filter query params are built for a sring collection field, there can be an "=" operator that is not compatible with Azure Search AI and returns the following error in the log:

Invalid expression: The operand for a binary operator 'Equal' is not a single value. Binary operators require both operands to be single values. Parameter name: $filter

This was discovered as part of setting up facets for an index created with this module. If this is not the recommended approach for taxonomy facets that have multiple values for a given field, would be happy to try a different approach.

Steps to reproduce

1. Create a field in the index that uses string collection (e.g. a taxonomy reference field with multiple values). Make it filterable and facetable.
2. Create a view and facet for the field.
3. Submit a facet with standard settings (including filter in URL).
4. Add the facet and attempt to filter.

Expected result:

The data is filtered per the facet selection

Actual result:

No data is returned after selecting the facet and the error in the problem above is encountered.

Proposed resolution

Similar to what is currently done for integer collections, handle string collections in the desired odata expression format for Azure Search AI (e.g. tags/any(t: t eq 'Mountain')). I believe this needs to be handled beyond the "IN" operator as an equals operator will result in this error.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jacobsaw created an issue. See original summary.

jacobsaw’s picture

Issue summary: View changes
jacobsaw’s picture

Issue summary: View changes
jacobsaw’s picture

Issue summary: View changes

jacobsaw’s picture

Status: Active » Needs review

interx made their first commit to this issue’s fork.

interx’s picture

Thanks for the report. I have altered the MR with some other changes

* Moved the logic for the special types outside of the operator check
* Added support for NOT IN
* Added support for multi-value conditions (also for integers)

Would it be possible to see if this still works as expected for your case compared to the original MR?

Thanks!

jacobsaw’s picture

Status: Needs review » Reviewed & tested by the community
jacobsaw’s picture

Thank you, changes look good and facets continued to function!

interx’s picture

Status: Reviewed & tested by the community » Fixed

This was committed, thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.