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: enhanced completion #259

Merged
merged 23 commits into from
Nov 12, 2024
Merged

feat: enhanced completion #259

merged 23 commits into from
Nov 12, 2024

Conversation

alexgarel
Copy link
Member

@alexgarel alexgarel commented Oct 25, 2024

Improvements on taxonomies completion API:

  • add the option of a preprocessor for taxonomies
  • add a preprocessor for Open Food Facts to handle:
    • brands taxonomy
    • add main language
    • add xx entries to all languages
  • fix to have names in synonyms
  • add a score to completion to first match shortest entries
  • enable querying multiple languages at once
  • added tests
  • suggest are now declared using a component inside search-bar, enabling more parameters to be supported in the future.
  • refactor web components to put interfaces in separate files
  • fixes on facets to support terms with "-" and multiple terms

TODO:

  • modifiy search-bar web component to use langs instead of lang.

* add the option of a preprocessor for taxonomies
* add a preprocessor for Open Food Facts to handle:
  * brands taxonomy
  * add main language
  * add xx entries to all languages
* fix to have names in synonyms
* add a score to completion to first match shortest entries
* enable querying multiple languages at once
* added tests
@alexgarel alexgarel marked this pull request as ready for review October 29, 2024 16:50
app/query.py Outdated Show resolved Hide resolved
alexgarel and others added 2 commits October 31, 2024 17:27
Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>
@github-actions github-actions bot added the 📚 Documentation Improvements or additions to documentation label Oct 31, 2024
@raphael0202
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor

@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.

It looks good to me, I added a few remarks about possible bugs above!

and fix a small bug on completion text that was not removed from suggestion input
@alexgarel
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member

teolemon commented Nov 6, 2024

@raphael0202
Copy link
Contributor

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 :)

@raphael0202 raphael0202 self-requested a review November 7, 2024 08:06
@alexgarel alexgarel merged commit 5e05aef into main Nov 12, 2024
8 checks passed
@alexgarel alexgarel deleted the fix-support-brands branch November 12, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants