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

Make facets start with a prefix #11241

Open
alexgarel opened this issue Jan 15, 2025 · 10 comments
Open

Make facets start with a prefix #11241

alexgarel opened this issue Jan 15, 2025 · 10 comments

Comments

@alexgarel
Copy link
Member

Problem

It's currently very difficult to tell if a url is a "facet" search.

Proposed solution

  1. Prefix facets uri with a "f/".

    • /categories -- becomes -> f/categories
    • /category/speculaas -- becomes -> f/category/speculaas
  2. Make old facets redirect uri to the new uris (permanent redirect)

I think the redirection can be done by apache (it is as fast as checking if first uri part is a taxonomy name), because generating all urls for nginx might be a bit cumbersome.

Additional context

This can help with:

  • adding rate limiting on facet on nginx side
  • better handling of priorities

Generally it's a good thing to be able to easily tell what kind of content a URL is.

@stephanegigandet
Copy link
Contributor

If we change URLs, then maybe it would be good to think a bit more about what URLs we want.

Adding a prefix for facets is a good idea. Another one that we floated around was to get rid of the translation of facet type.

e.g. instead of having https://fr.openfoodfacts.org/categorie/bananes , we use /category/

In fact I think it would be even better to get rid of the plural / singular distinction.

Today:

/categories -> list of facets, that links to /category/bananas (or /categorie/bananes) in French.

I think it would make sense to always use the plural tag types:

/f/categories
/f/categories/bananas

and always with the English name for the tag type (but keeping the local name for the tag value I think).

e.g.

in French: /f/additives/e330-acide-citrique , (but not /f/additives/e330-citric-acid )

@alexgarel
Copy link
Member Author

I agree with it @stephanegigandet.

Letting the translation of the facet name goes makes me a bit less enthusiast, but if it really cuts complexity, let's do it.

@stephanegigandet
Copy link
Contributor

Well, it's a choice, we can decide which change we want:

  1. adding /f (or /facets) to all facets
  2. using the plural for a single facet : /categories/bananas
  3. not translating the facet type
  4. not translating the facet value

we could do 1. and 2. only. I don't think we should do 4. We may want to do 3. but it is not necessary.
2. is interesting because it makes URLs easier to edit manually ;)

we could also do this:

  1. use /product/ in all languages, so that we don't have /produit/..

another choice to make: /f or /facets ? /p or /product ?

@alexgarel
Copy link
Member Author

A minor question is: should /f alone redirect to the home page or list available facets.

I would prefer redirect to the home page for now, but it might help discoverablity to list available facets.

@stephanegigandet
Copy link
Contributor

/f to return a list of facets is a good idea I think. It would make more sense to use /facets instead of /f.

@teolemon
Copy link
Member

What about /c/bananas ? Also, one thing for multi-languages, and stability is usually adding a stable id

/c/bananas-id12345
/c/bananes-id12345
/c/new-principal-name-of-bananas-id12345

@alexgarel
Copy link
Member Author

I don't understand you point @teolemon

It does not help identify facets if you don't put /f or /facets before.

For the id, what would it be ? We don't have such an id yet !

@stephanegigandet
Copy link
Contributor

Personal preference: understandable and readable / editable / guessable urls. :)

So avoid abbreviations, use /facets/categories/bananas instead of /f/c/bananas-4234

@aleene
Copy link
Contributor

aleene commented Jan 15, 2025

I do not see it as an issue. Either the user has to learn to type facets+categories or just categories. In all cases you need to explain it.

@teolemon
Copy link
Member

My main point is stable ids in urls, in addition to text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To discuss and validate
Development

No branches or pull requests

4 participants