Skip to content

Conversation

@camilleislasse
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
Docs? yes
License MIT

This PR adds metadata filtering support to local stores (InMemoryStore and CacheStore).

Changes

  • Add optional filter parameter to query() method accepting a callable
  • Filter documents by metadata before distance calculation
  • Add comprehensive test coverage for filtering scenarios
  • Add documentation for local stores

Usage

$results = $store->query($vector, [
     'filter' => fn(VectorDocument $doc) => $doc->metadata['size'] === 'S',
     'maxItems' => 10,
 ]);

@carsonbot carsonbot added Feature New feature Store Issues & PRs about the AI Store component Status: Needs Review labels Nov 16, 2025
Allow filtering documents by metadata before distance calculation using
a callable filter function.
@camilleislasse camilleislasse force-pushed the feature/local-store-filter-support branch from 20b1a23 to 84b3938 Compare November 16, 2025 13:34
@OskarStark OskarStark changed the title [Store] Add metadata filtering support to InMemoryStore and CacheStore [Store] Add metadata filtering support to InMemoryStore and CacheStore Nov 19, 2025
@chr-hertel
Copy link
Member

Thank you @camilleislasse.

@chr-hertel chr-hertel merged commit f0fbf2b into symfony:main Nov 20, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature Status: Reviewed Store Issues & PRs about the AI Store component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants