Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Filter: support multiple filter same field #134

Closed
wellingguzman opened this issue May 17, 2018 · 8 comments
Closed

Filter: support multiple filter same field #134

wellingguzman opened this issue May 17, 2018 · 8 comments
Labels
enhancement New feature or request

Comments

@wellingguzman
Copy link
Contributor

Allow multiple filter to the same column.

Country = 'Japan' OR Country = 'Germany'

@wellingguzman wellingguzman added the enhancement New feature or request label May 17, 2018
@rijkvanzanten
Copy link
Member

Isn't this already possible with the logical or thingy?

?filter[country][eq]=Japan&filter[country][logical]=or&filter[country][eq]=Germany

And even if that's not the way to do this, how about in? ?filter[country][in]=Japan,Germany

@wellingguzman wellingguzman added this to To do in v2.0.0-beta.1 Jun 25, 2018
@benhaynes
Copy link
Sponsor Member

@wellingguzman thoughts?

@wellingguzman
Copy link
Contributor Author

No, that's broken. The problem we are having here is that all fields are an "object" with all the keys being a field name, in that case if you create two filter using the same field, it will remove the first one.

The example below:

filter[country][eq]=Japan&filter[country][logical]=or&filter[country][eq]=Germany

Will end up being:

filter[country][eq]=Germany&filter[country][logical]=or

@beac0n
Copy link

beac0n commented Dec 14, 2018

furthermore, this would be very usefull for between filters:

filter[id][between]=1,15&filter[id][between]=30,45

to get the ranges 1-15 and 30-45

@wellingguzman
Copy link
Contributor Author

At the moment it supports multiple filter for te same field. The problem it could be a bit ugly, just for the sake of the "array in url" thing:

filter[id][][between]=1,15&filter[id][][between]=30,45

Although to include ranges between 1 and 15, and 30 and 45. it should be an or.

Here where it gets ugly:

filter[id][0][between]=1,15&filter[id][0][logical]=or&filter[id][1][between]=30,45

This was implemented by b37f5bb


I was thinking on trying to implement a parser to allow multiple fields without adding the array. In addiction to the default using array.

So it looks like this:

filter[id][between]=1,15&filter[id][between]=30,45

Instead of:

filter[id][][between]=1,15&filter[id][][between]=30,45

@benhaynes
Copy link
Sponsor Member

So @wellingguzman — is this ticket complete/closed now? Should we open a new ticket for cleaning up the syntax?

@wellingguzman
Copy link
Contributor Author

So @wellingguzman — is this ticket complete/closed now? Should we open a new ticket for cleaning up the syntax?

Yes @benhaynes, that would be ideal.

@benhaynes
Copy link
Sponsor Member

OK!

#675

v2.0.14 automation moved this from In progress to Done Dec 26, 2018
samvasko pushed a commit to samvasko/api that referenced this issue Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
No open projects
v2.0.0-beta.1
  
To do
v2.0.14
  
Done
Development

No branches or pull requests

4 participants