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

Add support for IN comparison for lists #255

Closed
2 tasks done
Tracked by #63
avaleske opened this issue Jul 22, 2021 · 1 comment · Fixed by #356
Closed
2 tasks done
Tracked by #63

Add support for IN comparison for lists #255

avaleske opened this issue Jul 22, 2021 · 1 comment · Fixed by #356
Assignees
Labels
epic: filtering Tickets related to Filtering size: 3 About a day of work
Milestone

Comments

@avaleske
Copy link

avaleske commented Jul 22, 2021

Steps:

  • Merge solution to main
  • merge upstream

For neighborhoods, unit size, and other filter types, we'll want to allow users to select multiple options of the same filter (for example, units with 1 and 2 bedrooms)

Right now the filter system assumes everything should be ANDed together, but queries like this need to be ORed together.

One option is to interpret a param with comma-separated values as a list, and use IN . So a querystring like ?filter[$comparison]=IN&filter[field]=val1,val2,val3 would come in as

{
  $comparison: "IN",
  field: val1,val2,val3,
}

which would be added to the query with a clause like AND WHERE lower(field) IN [val1, val2, val3]

This doesn't make as much sense if the comparison is something other than `IN but I think that's ok.

Also note the lowercasing of the field, which we'll do to the user provided values as well so the query is case-insensitive.

Also, while we're here, we should update the way the where params are inserted so that we're only inserting allowed strings

@avaleske avaleske mentioned this issue Jul 22, 2021
35 tasks
@avaleske avaleske added the epic: filtering Tickets related to Filtering label Jul 22, 2021
@avaleske avaleske added the M9 label Jul 22, 2021
@avaleske avaleske added this to the M9 milestone Jul 22, 2021
@avaleske avaleske added the size: 3 About a day of work label Jul 22, 2021
@avaleske avaleske changed the title Add support for ORing multiple options together Add support for IN comparison for lists Jul 23, 2021
@avaleske avaleske reopened this Aug 9, 2021
@avaleske
Copy link
Author

avaleske commented Aug 9, 2021

Just waiting for the upstream PR to be merged:
bloom-housing#1634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic: filtering Tickets related to Filtering size: 3 About a day of work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants