openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
GNU Affero General Public License v3.0
636 stars 371 forks source link

Add a filter option to show me products that have the bottom-most category set to X (eg:beers) #9189

Open DanieliusAsm opened 11 months ago

DanieliusAsm commented 11 months ago

Problem

When I want to clean up a giant category like beers it becomes difficult to do so. I already cleaned up IPA's so I would not want to see these products when im browsing beers parent category.

Proposed solution

A filter option to show me products that have the bottom-most category set to beers. Meaning that If a beer has category: beer->ales this beer wont be shown to me after I apply a filter.

This would also allow to easier fix a common issue where non-alcoholic beers are constantly assinged to beers category.

aleene commented 11 months ago

If you use a facet search, you can exclude as well, by adding a - in front of the category name. And you can use last edit date as well.

It might work, never tried though.

stephanegigandet commented 11 months ago

It's a good idea. It would require creating a new facet that only contains the most specific category.

alexgarel commented 10 months ago

maybe we could ask openfoodfacts-query to do this @john-gom ? :-)

john-gom commented 10 months ago

Hi @alexgarel . The query service could certainly do this, but I think the use case is more around iterating over specific products so that these can be corrected, so we'd still need to update the main Product Opener search to incorporate the criteria for the displayed products.

Perhaps it would make more sense to add this as a filter option in search-a-licious? @raphael0202

raphael0202 commented 10 months ago

It will be easy indeed to make such queried using search-a-licious!

teolemon commented 1 month ago

This is essential if we ever want to do 🥕 like product alternatives

alexgarel commented 2 weeks ago

One way to do it with search-a-licious is to say that we want the tag, but none of its children (direct children are enough):

categories:tag1 AND NOT categories:(child1 OR child2 OR child3)

note: this is for the next release of search-a-licious… for the current use categories_tags