Skip to content

[GH-959] Add datetime filter expr support - #960

Merged
o-love merged 2 commits into
mainfrom
fix/filter-time
Jan 27, 2026
Merged

o-love merged 2 commits into
mainfrom
fix/filter-time

Conversation

@o-love

@o-love o-love commented Jan 20, 2026 •

Copy link
Copy Markdown
Contributor

Purpose of the change

This PR adds support for datetime filtering in filter expressions by introducing a date() function that parses ISO format datetime strings.

New valid filter expressions: "name='test' AND created_at >= date('2025-01-01T00:00:00')"

Fixes/Closes

#959

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Unit Test
  • Integration Test

@o-love
o-love requested a review from Copilot January 20, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for datetime filtering in filter expressions by introducing a date() function that parses ISO format datetime strings. The changes enable users to filter results by datetime fields using comparison operators.

Changes:

  • Added date() function parser to handle ISO format datetime strings in filter expressions
  • Implemented test coverage for datetime filtering functionality
  • Added helper method to retrieve category names for a given set ID

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/memmachine/common/filter/filter_parser.py Adds parsing logic for date() function to convert ISO format strings to datetime objects
tests/memmachine/common/filter/test_filter_parser.py Adds comprehensive test cases for datetime parsing including valid/invalid formats and combinations with other expressions
src/memmachine/semantic_memory/semantic_memory.py Implements get_set_id_category_names method to retrieve category names for a set
src/memmachine/semantic_memory/semantic_session_manager.py Exposes get_set_id_category_names method in the session manager interface
tests/memmachine/semantic_memory/test_semantic_session_manager.py Adds integration test for search functionality with time-based filters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@o-love
o-love marked this pull request as ready for review January 20, 2026 14:48
@o-love o-love changed the title [GH-959] Add datetime filter expr support [Wait-for-merge][GH-959] Add datetime filter expr support Jan 20, 2026
@o-love
o-love force-pushed the fix/filter-time branch 2 times, most recently from 8e58a15 to c0d7a88 Compare January 20, 2026 14:57
@o-love o-love self-assigned this Jan 23, 2026
@jgong

jgong commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Hi @o-love , is this PR ready to merge? thanks!

@o-love
o-love force-pushed the fix/filter-time branch 2 times, most recently from 87888ec to 0685593 Compare January 27, 2026 18:49
@o-love
o-love changed the base branch from semantic-config to main January 27, 2026 18:49
@o-love o-love changed the title [Wait-for-merge][GH-959] Add datetime filter expr support [GH-959] Add datetime filter expr support Jan 27, 2026
@o-love
o-love merged commit cff6993 into main Jan 27, 2026
59 of 60 checks passed
@o-love
o-love deleted the fix/filter-time branch January 27, 2026 19:41
SarahScargall pushed a commit to SarahScargall/MemMachine that referenced this pull request Jan 29, 2026
* [MemMachineGH-959] Add datetime filter expr support

* Apply Neo4j time fixes
tz = _dt.UTC
return value.replace(tzinfo=tz)
utc_offset = value.utcoffset()
tz = _dt.timezone(utc_offset) if utc_offset is not None else tzinfo

@edwinyyyu edwinyyyu Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May SEGFAULT with bad implementation.

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.

6 participants