Skip to content

Fix: Add missing filter methods to AsyncMemory#3624

Merged
parshvadaftari merged 1 commit intomem0ai:mainfrom
frederikb96:fix/async-filter-methods
Oct 22, 2025
Merged

Fix: Add missing filter methods to AsyncMemory#3624
parshvadaftari merged 1 commit intomem0ai:mainfrom
frederikb96:fix/async-filter-methods

Conversation

@frederikb96
Copy link
Copy Markdown
Contributor

@frederikb96 frederikb96 commented Oct 19, 2025

Problem

AsyncMemory.search() was calling _has_advanced_operators() and _process_metadata_filters() methods that only existed in the sync Memory class, causing AttributeError when using the filters parameter in async context.

Solution

Copied both missing methods from Memory to AsyncMemory:

  • _has_advanced_operators() - Detects advanced filter operators
  • _process_metadata_filters() - Processes enhanced filter syntax

These are pure utility methods (no I/O) that were forgotten during previous updates. No new code written, just copied the existing implementations to restore sync/async parity.

Why Not Refactor?

The codebase follows a sync/async duplication pattern throughout (both classes ~2000 lines each). While not ideal, this maintains consistency with the existing architecture. A proper refactor to extract shared utilities would be a separate effort.

Testing

  • ✅ Linting passes
  • ✅ Methods are pure functions (no side effects)

Fixes blocker for using filters with async memory operations.

@frederikb96
Copy link
Copy Markdown
Contributor Author

The pipeline failures are from merged commit de224dd26d4d8d2108804537cc0cef2dad5d60ec and not related to this PR 🙂

frederikb96 added a commit to frederikb96/mem0 that referenced this pull request Oct 19, 2025
Enables date range and metadata filtering in MCP search endpoint.
Previously only supported basic query parameter.

- Add filters parameter with example annotation
- Pass filters to AsyncMemory.search()
- Maintains backward compatibility (filters optional)

Example usage: filters={'created_at': {'gte': '2025-01-15T10:00:00'}}

Depends on PR mem0ai#3624 (AsyncMemory filter methods fix)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@parshvadaftari parshvadaftari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@parshvadaftari
Copy link
Copy Markdown
Contributor

Hey @frederikb96 can you update your branch since the tests are failing and sync with the latest main? Thanks!

AsyncMemory was calling _has_advanced_operators() and
_process_metadata_filters() but these methods only existed in the
sync Memory class, causing AttributeError when using filters.

- Copy _has_advanced_operators() from Memory class
- Copy _process_metadata_filters() from Memory class
- No new code written, just copied forgotten methods

This maintains the existing sync/async duplication pattern. Not
beautiful, but necessary before any potential refactor of the
duplicate code structure.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@frederikb96 frederikb96 force-pushed the fix/async-filter-methods branch from 4622338 to 105c3b7 Compare October 22, 2025 09:39
@frederikb96
Copy link
Copy Markdown
Contributor Author

Hey, yes no problem, I rebased it :)

@parshvadaftari parshvadaftari merged commit 2692e49 into mem0ai:main Oct 22, 2025
5 of 7 checks passed
@parshvadaftari
Copy link
Copy Markdown
Contributor

Thank you for making mem0 better @frederikb96

@frederikb96 frederikb96 deleted the fix/async-filter-methods branch October 22, 2025 11:35
garciaba79 pushed a commit to garciaba79/mem0 that referenced this pull request Feb 12, 2026
Co-authored-by: Claude <noreply@anthropic.com>
jamebobob pushed a commit to jamebobob/mem0-vigil-recall that referenced this pull request Mar 29, 2026
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants