Problem/Motivation

If a single value field is given multiple conditions Views/Search API uses IN or NOT IN operator and the query fails

Steps to reproduce

  1. E.g. index the node bundle (type) into Milvus
  2. Add a condition like IN (page, article) via Views
  3. See that it fails

Query to Milvus is:
(type in "article", "page")

BUT Milvus syntax should be:
(type in ["article", "page"])

Proposed resolution

Fix the conditon

Remaining tasks

MR
Backport to 1.1

User interface changes

N/A

API changes

N/A

Data model changes

N/A

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

scott_euser created an issue. See original summary.

scott_euser’s picture

Issue summary: View changes
Status: Active » Needs review
Issue tags: +needs backport to 1.x

csakiistvan’s picture

Assigned: Unassigned » csakiistvan
csakiistvan’s picture

Status: Needs review » Reviewed & tested by the community

Environment

  • Drupal 11.3.9
  • PHP 8.5
  • search_api 8.x-1.40
  • ai_vdb_provider_milvus 1.x-dev (patch applied manually)

What was tested

MilvusProvider::processConditionGroup() was called with a real Search API index
(node datasource, type field, string type, single-value cardinality)
and a ConditionGroup carrying each operator variant. The generated filter strings
were compared against the expected Milvus syntax.

Results

  • IN with two values: (type IN ["page","article"]) — correct
  • NOT IN with two values: (type NOT IN ["page","article"]) — correct
  • IN with a single value: (type IN ["page"]) — correct
  • ✅ Equality operator (regression check): (type == "page") — unaffected

Before the patch, the same conditions produced (type in "page","article") (missing brackets), which Milvus rejects as invalid syntax.

Conclusion

The fix is correct and complete. IN and NOT IN filter expressions now
wrap their value list in […] as required by Milvus, while all other operators remain unaffected.
RTBC.

This comment was produced with the assistance of an LLM.

csakiistvan’s picture

Assigned: csakiistvan » Unassigned

  • scott_euser committed 1d3f9e86 on 2.0.x
    fix: #3572792 Filter syntax for IN/NOT IN not always correct
    
    By:...

  • scott_euser committed 7e4dfdeb on 1.1.x
    fix: #3572792 Filter syntax for IN/NOT IN not always correct
    
    By:...
scott_euser’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for testing and confirming, much appreciated!

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

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

Maintainers, credit people who helped resolve this issue.

arianraeesi’s picture

Status: Fixed » Closed (fixed)

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