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 new search param to refine mapping type filter #3852

Closed
willemarcel opened this issue Nov 9, 2020 · 4 comments · Fixed by #3904
Closed

Add new search param to refine mapping type filter #3852

willemarcel opened this issue Nov 9, 2020 · 4 comments · Fixed by #3904
Assignees
Labels

Comments

@willemarcel
Copy link
Contributor

The search param /api/v2/projects/?mappingTypes=BUILDINGS right now returns projects whose mapping type field contains buildings, but includes projects set with buildings and other types.

Add a new search param that would filter projects strictly, so in the case mentioned above it would return projects whose mapping type is only BUILDINGS

@d-rita
Copy link
Contributor

d-rita commented Nov 17, 2020

@willemarcel, To add to this functionality, what should happen when a person selects multiple mapping types? Should the result include projects with all mapping types or any of them? For example, should the search query /api/v2/projects/?mappingTypes=BUILDINGS,ROADS return projects strictly with both types, or can the search results include projects with any and both types?

@willemarcel
Copy link
Contributor Author

@d-rita On the backend, I propose to add a new search param, it could be named mappingTypesExact to receive a true / false value. The default would be false and would make mappingTypes work as it is now. If it is true, would switch to the exact match.

Then on the frontend we can add a switch.

@ramyaragupathy what do you think?

@ramyaragupathy
Copy link
Member

@willemarcel - Yes that sounds right - so it will be,
https://tasking-manager-tm4-production-api.hotosm.org/api/v2/projects/?mappingTypes=ROADS&mappingTypesExact=true

It would be nice to have these two as interdependent parameters, so that it mappingTypesExact becomes required only if mappingTypes is specified. I am checking out options in flask framework for this implementation, @willemarcel - if you're already aware of this, please add.

@willemarcel
Copy link
Contributor Author

@ramyaragupathy I think it's not required to do that check, only assure that mappingTypesExact would have any effect if it's alone. If it's not present, the default value is false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants