Skip to content

Support chaining FindQuery filters - #844

Open
lh0156 wants to merge 1 commit into
redis:mainfrom
lh0156:agent/find-query-chain-780
Open

Support chaining FindQuery filters#844
lh0156 wants to merge 1 commit into
redis:mainfrom
lh0156:agent/find-query-chain-780

Conversation

@lh0156

@lh0156 lh0156 commented Jul 26, 2026

Copy link
Copy Markdown

Summary

Implements #780 by allowing FindQuery instances to accept additional filter expressions through .find().

What changed

  • Adds FindQuery.find(*expressions) and returns a new query, leaving the original unchanged.
  • Appends expressions to the existing query so they use the same AND semantics as Model.find(expr1, expr2).
  • Preserves the query's KNN state when creating the chained query.
  • Documents incremental filter construction.

Testing

  • pytest -q tests/test_find_query.py tests_sync/test_find_query.py: 52 passed.
  • pytest -q tests --ignore tests/test_benchmarks.py: 261 passed.
  • pytest -q tests_sync --ignore tests_sync/test_benchmarks.py: 261 passed.
  • ruff check and ruff format --check on changed source/tests.
  • python -m compileall -q aredis_om tests.
  • bandit -q -r aredis_om/model/model.py -s B608.

Redis Stack was run locally through Docker Compose for the integration tests; benchmark tests were excluded from the full run.


Note

Low Risk
Small additive API on FindQuery using existing copy/execute paths; behavior is covered by tests with no auth or data-migration impact.

Overview
Adds FindQuery.find(*expressions) so you can append filters on an existing query instead of only passing them all at once to Model.find(). Each call returns a new query via copy(); the prior query is unchanged. New expressions are AND-combined with existing ones, matching Model.find(expr1, expr2), and KNN state is carried forward when chaining.

Docs in querying.md show building filters incrementally. Async integration coverage confirms chaining behavior and immutability of the base query.

Reviewed by Cursor Bugbot for commit 1a42823. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

1 participant