openfoodfacts / search-a-licious

🍊🔎 A pluggable search service for large collections of objects (like Open Food Facts)
https://search.openfoodfacts.org
GNU Affero General Public License v3.0
10 stars 6 forks source link

feat: enhanced completion #259

Closed alexgarel closed 1 week ago

alexgarel commented 3 weeks ago

Improvements on taxonomies completion API:

TODO:

raphael0202 commented 1 week ago

In the search bar, when typing a single letter and deleting it, an autocomplete query with an empty q to the server:

http://search.localhost:8000/autocomplete?q=&langs=en&taxonomy_names=brands,categories&size=5

raphael0202 commented 1 week ago

In en language, when searching chicken, I have the following results:

Capture d’écran du 2024-11-06 10-34-32

I was expecting Chickens as first result instead of chicken meat (both terms are linked to the same taxonomy entry en:chickens).

Also, the search results are not normalized: some are capitalized, some are not.

raphael0202 commented 1 week ago

Clicking on a brand suggested by auto-completion does not seem to work. For example, with Casino, we have 0 results when clicking on autosuggestion, while clicking on casino on the left brand panel returns 4.3k results. It looks like it's due to wrong language prefix added when clicking on autosuggestion:

http://search.localhost:8000/static/off.html?off_q=&off_facetsFilters=brands%3A%22en%3Acasino%22&off_page=1

alexgarel commented 1 week ago

Clicking on a brand suggested by auto-completion does not seem to work. For example, with Casino, we have 0 results when clicking on autosuggestion, while clicking on casino on the left brand panel returns 4.3k results. It looks like it's due to wrong language prefix added when clicking on autosuggestion

The prefix is not wrong in regard to the taxonomy… but the brands_tags field is different from the rest of the _tags field because it has no language prefix…

I will remove the language prefix for now.

alexgarel commented 1 week ago

In en language, when searching chicken, I have the following results: I was expecting Chickens as first result instead of chicken meat (both terms are linked to the same taxonomy entry en:chickens).

Also, the search results are not normalized: some are capitalized, some are not.

I tried to change entries order in the array, but it does not change… and don't know how to change that in Elasticsearch…

So I added the entry name in the label, this way it's more easy to understand.

teolemon commented 1 week ago

We could get a category image using wikidata: https://wikidata.org/w/rest.php/wikibase/v1/entities/items/Q20034?_fields=type,labels,descriptions,aliases,statements,sitelinks (image is P18)

raphael0202 commented 1 week ago

I tried to change entries order in the array, but it does not change… and don't know how to change that in Elasticsearch… So I added the entry name in the label, this way it's more easy to understand.

That's fine, it's a very minor issue :)