Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please auto group related record filters of the same type #965

Closed
ivan006 opened this issue Aug 16, 2024 · 3 comments
Closed

Please auto group related record filters of the same type #965

ivan006 opened this issue Aug 16, 2024 · 3 comments

Comments

@ivan006
Copy link

ivan006 commented Aug 16, 2024

Say a user wants to filter using multiple criteria for related a record of the same type.

E.g.

get_records?filter[related_typeA_records.attrX]=valX
&filter[related_typeA_records.attrY]=valY

i cant imagine a case where users intends to not have these criteria grouped. But you guys are not grouping them automatically. This is odd. Let me explain:

this is what you guys interpret the query to mean

get me records where

  • at least one related type A record meets criteria x and
  • at least one related type A record meets criteria y

but the below interpretation would much more useful (grouping) and way more likely to be what the user is trying to achieve

get me records where

  • at least one related type A record meets
    • criteria x and
    • criteria y
@ivan006 ivan006 changed the title Please auto group related record filters Please auto group related record filters of the same type Aug 16, 2024
@AlexVanderbist
Copy link
Member

Hey, this is an interesting idea. Generally, all query builder filters are combined using a logic AND. However, like you mentioned, once combined, the various related attribute filters are logical ORs. I'm not sure whether we need to add any code to handle this specific edge case (in practice I've created custom filters for these kind of edge cases) but let's continue this discussion in your PR.

@ivan006
Copy link
Author

ivan006 commented Oct 3, 2024

what PR? also this isnt a hedge case this is very standard usage. anyway i just made my own library but i would suggest you guys look into this. @AlexVanderbist

@ivan006
Copy link
Author

ivan006 commented Oct 3, 2024

also its not a matter of OR/AND its a matter or "HAS child with x AND Y" instead of "HAS child with x AND has child with Y". So its a logical grouping problem not an logical operator problem (AND/OR)

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

No branches or pull requests

2 participants