feat(query): add FilterExpression.not() operator#30
Closed
ajGingrich wants to merge 3 commits into
Closed
Conversation
Closes #18 Mirrors Python redisvl's ~filter negation. .not() wraps an expression in -(...), and negating the wildcard '*' collapses to '*' (negating "match everything" is a no-op). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds unary negation support to the query filter DSL via FilterExpression.not(), matching the requested -(...) rendering and wildcard-collapse behavior.
Changes:
- Adds
NOThandling and.not()toFilterExpression. - Adds unit coverage for simple, wildcard, double, composed, and nested negation.
- Updates filter/query docs and ignores local
.worktrees/.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/query/filter.ts |
Implements FilterExpression.not() rendering and validation. |
tests/unit/query/filter.test.ts |
Adds unit tests for negation behavior and composition. |
website/docs/user-guide/filters-and-queries.md |
Documents .not() usage in filter composition examples. |
.gitignore |
Adds .worktrees/ to ignored local files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Addresses Copilot review feedback on #30. The snippet uses FilterExpression for the wildcard collapse examples; add it to the import so the example is copy-pasteable. PR-Shepherd: true PR-Shepherd-Mode: manual Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18
Summary
FilterExpression.not()mirroring Python redisvl's~filternegation, wrapping an expression in-(...).*collapses to*(negating "match everything" is a no-op).filters-and-queries.mdwith.not()examples alongside.and()/.or().Test plan
.and()/.or()and nested expressionsnpm test -- --run tests/unit→ 429 passing (up from 421)npm run lintclean,npm run format:checkclean🤖 Generated with Claude Code