mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-21 08:37:05 +08:00
Fix case-insensitive matching for manual meta_data_filter in / not in list values (#14397)
## Summary Fixes case-asymmetric matching for manual `meta_data_filter` when using **`in`** / **`not in`** with a **list** `value`. Document metadata strings were lowercased, but list elements were not, so values like `"F2"` failed to match `["F2", "F11"]` even though **`=`** behaved correctly. Closes #14389 ## Changes - **`common/metadata_utils.py`**: For **`in`** / **`not in`**, normalize string elements when `value` and/or `input` is a list, consistent with scalar string lowercasing. - **`test/unit_test/common/test_metadata_filter_operators.py`**: Regression tests for list `value` case-insensitivity and **`not in`**. ## Type of change - [x] Bug fix (non-breaking)
This commit is contained in:
@ -98,8 +98,12 @@ def meta_filter(metas: dict, filters: list[dict], logic: str = "and"):
|
||||
# Non-comparison operators: maintain original logic
|
||||
if isinstance(input, str):
|
||||
input = input.lower()
|
||||
elif operator in ("in", "not in") and isinstance(input, list):
|
||||
input = [x.lower() if isinstance(x, str) else x for x in input]
|
||||
if isinstance(value, str):
|
||||
value = value.lower()
|
||||
elif operator in ("in", "not in") and isinstance(value, list):
|
||||
value = [x.lower() if isinstance(x, str) else x for x in value]
|
||||
|
||||
matched = False
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user