Merged
Conversation
… in AST Add PropertiesLiteral struct and PropertyMatchValue enum to support filtering items by their entity_properties values. Add PropertyFilter to EntityFilters as the user-facing API, with expansion logic that converts property filters into the AST representation. Supports SelectOption (UUID match via ? operator) and EntityRef (entity_id match via @> operator) value matching strategies.
Add build_properties_filter() that generates EXISTS subqueries against entity_properties table. Supports SelectOption matching (? operator) and EntityRef matching (@> operator). The filter is applied in the document TopItems clause, leveraging the existing PREFIX CTE for access control via UserAccessibleItems.
Add 7 unit tests for PropertiesLiteral AST expansion covering: - Single select option, multiple options (OR), entity ref matching - Multiple property filters (AND), mixed option+entity_ref (OR) - Empty filters produce no AST Add 5 integration tests for dynamic soup query with property filters: - Filter by single select option (Priority = Low) - Filter matching one document (Status = Completed) - AND-ing multiple property filters - No-match filter returns no documents - OR-ing multiple option values within a single filter Also fix EntityFilters::is_empty to check individual PropertyFilter emptiness rather than just vec length.
Parameterize build_properties_filter with entity_id_sql so it generates the correct table alias for each clause: d.id for documents, c.id for chats, p.id for projects. Previously only documents were filtered.
Make entity_type Option<String> on both PropertyFilter and PropertiesLiteral. When None, the entity_type clause is omitted from the EXISTS subquery, allowing a single filter to match properties across all entity types (TASK, DOCUMENT, PROJECT, etc.). Add unit tests for None vs Some(entity_type) serialization and integration tests verifying cross-type matching and scoped matching.
…s_combined Use ..Default::default() to cover the new property_filters field added to EntityFilters, fixing compilation with --all-features.
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.
macro-cy6PBPLDtRh31ivFR2vUc-properties-filtering-in-soup