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

Product filter by category #217

Closed
raphodn opened this issue Feb 21, 2024 · 4 comments · Fixed by #234
Closed

Product filter by category #217

raphodn opened this issue Feb 21, 2024 · 4 comments · Fixed by #234
Labels
help wanted Extra attention is needed ⭐ top issue Top issue. ✅ Task

Comments

@raphodn
Copy link
Member

raphodn commented Feb 21, 2024

Story

Following #154

We need to add a new filter capability to find only products of a certain category. Bonus : allow filtering by multiple categories as well.

But I'm not exactly sure how to proceed with the fastapi-filter library. I opened an issue : arthurio/fastapi-filter#556

Or maybe I'm missing something ? 😅

@raphodn raphodn added ✅ Task help wanted Extra attention is needed labels Feb 21, 2024
@github-actions github-actions bot added the ⭐ top issue Top issue. label Feb 24, 2024
@raphodn
Copy link
Member Author

raphodn commented Feb 27, 2024

@raphael0202 need your help on this 😇

@raphael0202
Copy link
Contributor

From what I see it's not supported by fastapi-filter, we can either:

  • work on adding this feature to fastapi-filter, and wait for a release
  • supercharge the fastapi-filter class to implement it from our side, without contributing to the source

I would personally be in favor of option 1 if the maintainer reply fast :)

@raphodn
Copy link
Member Author

raphodn commented Mar 2, 2024

I looked into updating the fastapi-filter library, but our need here is linked to postgresql array, whereas the library does only filtering on basic/sqlite fields.

So I ended up trying something in our API directly, you can have a look here : #234

  • it works :)
  • missing some tests (still having issues with our test setup, when I comment out the product filtering tests they fail)

@raphodn
Copy link
Member Author

raphodn commented Mar 14, 2024

Now possible to filter by categories_tags (single tag only) : Done in #234

https://prices.openfoodfacts.org/api/v1/products?categories_tags__contains=en:beverages

Edit : now possible to filter by labels_tags (single tag only) : done in #238

https://prices.openfoodfacts.org/api/v1/products?labels_tags__contains=en:organic

Edit 2 : now possible to filter by brands_tags (single tag only) : done in #390

https://prices.openfoodfacts.org/api/v1/products?brands_tags__contains=carrefour-bio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed ⭐ top issue Top issue. ✅ Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants