From 0df65d358a229cfc8a70e72f7cef4a79fcc034b8 Mon Sep 17 00:00:00 2001 From: NeedmeFordev <124189514+spider-yamet@users.noreply.github.com> Date: Tue, 28 Apr 2026 08:51:48 +0200 Subject: [PATCH] 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) --- common/metadata_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/metadata_utils.py b/common/metadata_utils.py index c919bd186..f767b3bd5 100644 --- a/common/metadata_utils.py +++ b/common/metadata_utils.py @@ -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: