KnowledgeRetrievalNode metadata filter not support 'in' #12655

Closed
opened 2026-02-21 19:08:22 -05:00 by yindo · 3 comments
Owner

Originally created by @yg2024 on GitHub (Apr 8, 2025).

Originally assigned to: @JohnJyong on GitHub.

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

KnowledgeRetrievalNode metadata filter not support 'in'

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @yg2024 on GitHub (Apr 8, 2025). Originally assigned to: @JohnJyong on GitHub. ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. KnowledgeRetrievalNode metadata filter not support 'in' ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 19:08:22 -05:00
yindo closed this issue 2026-02-21 19:08:22 -05:00
Author
Owner

@yg2024 commented on GitHub (Apr 8, 2025):

case "in":
                filters.append(
                    (text(f"documents.doc_metadata ->> :{key} = any(string_to_array(:{key_value},',')")).params(
                        **{key: metadata_name, key_value: f"{value}"}
                    )
                )
@yg2024 commented on GitHub (Apr 8, 2025): ```python case "in": filters.append( (text(f"documents.doc_metadata ->> :{key} = any(string_to_array(:{key_value},',')")).params( **{key: metadata_name, key_value: f"{value}"} ) ) ```
Author
Owner

@Sligcm commented on GitHub (Apr 18, 2025):

+1, Strongly need support for IN queries on metadata.

@Sligcm commented on GitHub (Apr 18, 2025): +1, Strongly need support for IN queries on metadata.
Author
Owner

@vivianxe-ifast commented on GitHub (Apr 22, 2025):

I was trying to enable manual metadata filter. I've created a field to append all user roles in a string with comma as delimiter. When i add condition role (metadata) contains result (variable), it is unable to works.

Input
role: 'customer_service'
result: 'customer_service,operation,admin'

Condition
role.contains(result) -> this condition is return false
result.in(role) -> this condition should return true (but not supported currently)

Looking forward on the enhancement.

Image
@vivianxe-ifast commented on GitHub (Apr 22, 2025): I was trying to enable manual metadata filter. I've created a field to append all user roles in a string with comma as delimiter. When i add condition **role (metadata)** contains **result (variable)**, it is unable to works. **Input** role: 'customer_service' result: 'customer_service,operation,admin' **Condition** role.contains(result) -> this condition is return false result.in(role) -> this condition should return true (but not supported currently) Looking forward on the enhancement. <img width="418" alt="Image" src="https://github.com/user-attachments/assets/b7d49e43-df54-4f8e-9301-d62df0026f9d" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12655