Skip to content

merge filters for same key #3952

@codingDuan

Description

@codingDuan

🐛 Describe the bug

@ mem0/memory/main.py :888

case:

# input
filters = {
    'created_at': {
        'gte': 1769686064,  
        'lte': 1769788064   
    }
}

# ❌ Bug:overwrite the same key
{
    'created_at': {'lte': 1769688064}  # gte missing
}

# ✅ expect
{
    'created_at': {
        'gte': 1769686064,
        'lte': 1769688064
    }
}

reason:

# mem0 
result = {}
for operator, value in condition.items():
    if operator in operator_map:
        result[key] = {operator_map[operator]: value}  # ❌ overwrite
    else:
        raise ValueError(...)

fix plan:

# mem0 
result = {}
for operator, value in condition.items():
    if operator in operator_map:
        result[key][operator_map[operator]] = value #✅
    else:
        raise ValueError(...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highBlocks significant use case, high demandbugSomething isn't workingsdk-pythonPython SDK specific

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions