mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-06 18:45:08 +08:00
### What problem does this PR solve? Bug: When a filter key doesn't exist in metas or has no matching values, the filter was skipped entirely, causing AND logic to fail. Example: - Filter 1: meeting_series = '宏观早8点' (matches doc1, doc2, doc3) - Filter 2: date = '2026-03-05' (no matches) - Expected: [] (AND should return empty) - Actual: [doc1, doc2, doc3] (Filter 2 was skipped) Root cause: Old logic iterated metas.items() first, then filters. If a filter's key wasn't in metas, it was never processed. Fix: Iterate filters first, then look up in metas. If key not found, treat as no match (empty result), which correctly applies AND logic. Changes: - Changed loop order from 'for k in metas: for f in filters' to 'for f in filters: if f.key in metas' - Explicitly handle missing keys as empty results ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: Clint-chan <Clint-chan@users.noreply.github.com>