feat(querying): support mixed AND/OR filters, !attribute (not-exists), and forward id on polymorphic endpoints - #166
Closed
Mortega5 wants to merge 2 commits into
Closed
feat(querying): support mixed AND/OR filters, !attribute (not-exists), and forward id on polymorphic endpoints#166Mortega5 wants to merge 2 commits into
Mortega5 wants to merge 2 commits into
Conversation
…ts) filters The TMForum standard never actually prohibits combining AND(&) and OR(;) in a single filter query, and NGSI-LD's own q= already defines AND-before-OR precedence for an un-parenthesized term chain - so this connector's blanket rejection was defensive code working around a translation bug, not a spec requirement. Removes it from QueryParser, SubscriptionQueryParser, and SubscriptionQueryResolver (which independently duplicated the same guard at event-match time), replacing the single-LogicalOperator-per-query design with one that preserves each parameter's original connector. Also adds support for NGSI-LD's bare `!attribute` (not-exists) syntax, mirrored directly with no TMForum-side translation layer, including through relationship sub-paths and reserved-word-escaped fallback attributes. !id and !type are rejected, since id/type always exist. SubscriptionQueryParser's "OR cannot combine with fields" rule is dropped entirely (fields only affects payload projection, orthogonal to match logic, and had no standards or functional basis). Its other two rules are kept but narrowed to specific token adjacency instead of "this operator appears anywhere in the query". Co-Authored-By: Claude Sonnet 5 <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.
Combine AND (&) and OR (;) in the same filter query, e.g.
status=Active,Started&color=Red(previously rejected outright when a query mixed both operators).Filter on non-existent attributes with
!attribute(NGSI-LD syntax), e.g.!statusor!relatedParty.datasetId, including combined with AND/OR (!status&color=Red).!idand!typeremain rejected since they always exist.Use
fieldstogether with OR in subscriptions, e.g.event.product.name=Some;fields=event.product.id(previously blocked with no real functional justification).Filter by
idon polymorphic list endpoints, e.g.GET /resource?id=urn:f-1,urn:f-2(previously theidparameter was silently ignored when listing polymorphic types).