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

feat: 620 - Elastic Search autocomplete for categories #834

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

monsieurtanuki
Copy link
Contributor

What

  • First use of the Elastic Search API: autocomplete for categories in TEST env.
  • TODO in other PRs
    • access to PROD env (so far, only TEST env works)
    • other fuzziness levels (so far, just none)
    • other taxonomy names (so far, just category)

Part of

Files

New files:

  • api_search_test.dart: Tests around the Elastic Search API.
  • autocomplete_search_result.dart: Result of an autocomplete search on the Elastic Search API.
  • autocomplete_search_result.g.dart: generated
  • autocomplete_single_result.dart: Single item result of an autocomplete search on the Elastic Search API.
  • autocomplete_single_result.g.dart: generated
  • fuzziness_level.dart: Fuzziness Level for Elastic Search API.
  • open_food_search_api_client.dart: Client calls of the Open Food Facts Elastic Search API.
  • taxonomy_name.dart: Taxonomy Name for Elastic Search API.

Impacted files:

  • openfoodfacts.dart: exported the new 5 files.
  • uri_helper.dart: added a forcedHost parameter in order to deal with alternative subdomains like search for Elastic Search

New files:
* `api_search_test.dart`: Tests around the Elastic Search API.
* `autocomplete_search_result.dart`: Result of an autocomplete search on the Elastic Search API.
* `autocomplete_search_result.g.dart`: generated
* `autocomplete_single_result.dart`: Single item result of an autocomplete search on the Elastic Search API.
* `autocomplete_single_result.g.dart`: generated
* `fuzziness_level.dart`: Fuzziness Level for Elastic Search API.
* `open_food_search_api_client.dart`: Client calls of the Open Food Facts Elastic Search API.
* `taxonomy_name.dart`: Taxonomy Name for Elastic Search API.

Impacted files:
* `openfoodfacts.dart`: exported the new 5 files.
* `uri_helper.dart`: added a `forcedHost` parameter in order to deal with alternative subdomains like `search` for Elastic Search
@g123k
Copy link
Contributor

g123k commented Nov 22, 2023

Apart from your code, I was wondering whether we shouldn't create an experimental part in the SDK.
That would make it possible to include this PR, but also the one for pricing.
The idea would be to say: you can test, but at any time the API can change or disappear.

Copy link

@raphael0202 raphael0202 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the advantage of this API is the support for brand, is it something you plan to add as well?

@monsieurtanuki monsieurtanuki merged commit 1672f1a into openfoodfacts:master Nov 23, 2023
5 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @raphael0202 for your review!

As I wrote, there are things that I planned to code but I'm blocked and you may be helpful:

  • could you provide a list to all (or many) "taxonomy name"s, or a way to get them?
  • could you provide a list of values and meanings of fuzziness levels?
  • any idea when the PROD env will be available?

@raphael0202
Copy link

raphael0202 commented Nov 23, 2023

could you provide a list to all (or many) "taxonomy name"s, or a way to get them?

Yes, it's available here! If you need more, it's easy to index new ones
https://github.com/openfoodfacts/search-a-licious/blob/main/data/config/openfoodfacts.yml#L132

could you provide a list of values and meanings of fuzziness levels?

Fuziness is an int, it's the maximum allowed levenshtein distance (=number of edits): https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#fuzziness

any idea when the PROD env will be available?

We plan to install search-a-licious on off1, the server that was used so far to host Product Opener (the migrations went smoothly yesterday 🎉). We need to perform software and hardware upgrades, it's expected to be ready in ~3 weeks.

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

Successfully merging this pull request may close these issues.

4 participants