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

Add autocomplete to the search text field #147

Open
Tracked by #991
monsieurtanuki opened this issue Feb 4, 2021 · 10 comments
Open
Tracked by #991

Add autocomplete to the search text field #147

monsieurtanuki opened this issue Feb 4, 2021 · 10 comments

Comments

@monsieurtanuki
Copy link
Contributor

monsieurtanuki commented Feb 4, 2021

What

  • Add autocomplete to the search text field either with search history or relevant food suggestions.

Part of

@M123-dev
Copy link
Member

M123-dev commented Feb 4, 2021

I can recommend this package for suggestions

@monsieurtanuki
Copy link
Contributor Author

This package goes even further than what I imagined.

What I imagined: when the end-user types in their text, the suggestions come from their search history, predetermined words or words we collect from the products already downloaded.

What this package may enable: a server database lookup - if I type in "wasa" the collection of "wasa" breads will be displayed even before I click on the "search" button.

Now that I'm thinking most suggestion packages are probably able to do that - something like an async lookup in a local database or a remote database.

That also means that on the server side they should be able to tell us "cookies? more than 500 results", "cookies chocolate? 152 results", "cookies chocolate walnut? only 12 results, here they are".

@stephanegigandet
Copy link
Contributor

Related to that, we do have an API to get suggestions for categories names, but not for product names / brands. (at least not yet)

https://world.openfoodfacts.org/cgi/suggest.pl?tagtype=categories&term=sou

@monsieurtanuki
Copy link
Contributor Author

@stephanegigandet Something like that could be interesting, but it's much too verbose as is.

Assuming that I speak French and that I type in only sou, I think I'd be very surprised to see "Turrón au chocolat avec riz soufflé" or "Boules de maïs soufflées au miel non enrichies en vitamines et minéraux" - unless it was precisely what I had in mind but was too lazy to type in :)

@stephanegigandet
Copy link
Contributor

I guess we could try to weight the suggestions by frequency, or number of products or something.

@monsieurtanuki
Copy link
Contributor Author

monsieurtanuki commented Feb 4, 2021

@stephanegigandet I've just noticed that the autocomplete feature is not implemented on the server side either.
I guess it's not that easy to implement.
At least, we can keep the local keyword search history, and use the previous search keywords as suggestions.
And at a higher level do it like Google, that also keeps the search keyword history (on the server side) and give each keyword a weight (frequency? number of products?) to order them. Is it possible on the server side?

For instance I've just searched "soupe potiron" on OFF.fr, which does not fit any category (the correct word being "velouté"). I guess the search keyword history makes more sense.
[Edit]: I mean, I found products with "soupe potiron", which is good, but the autocomplete with categories wouldn't have worked (or so I assume).

monsieurtanuki referenced this issue in monsieurtanuki/smooth-app Feb 27, 2021
…ield

Implemented a look-up on the local database, and linked it to the text field.
For the moment, the matching products are only printed in the console.
The next step would be to display the results with an autocomplete text field.

Impacted files:
* `dao_product.dart`: new method `List<Product> getSuggestions(String)`
* `home_page.dart`: added an `onUpdate` method on the text field to print the products that match locally
monsieurtanuki added a commit that referenced this issue Feb 27, 2021
feature/#147 - local look-up - first step towards autocomplete text field
@stephanegigandet
Copy link
Contributor

Tracking bug for server side support of autocomplete suggestions: openfoodfacts/openfoodfacts-server#5006

@teolemon teolemon changed the title Search text field with autocomplete Add autocomplete to the search text field Mar 19, 2022
@teolemon teolemon added this to the V2 milestone Apr 4, 2022
@teolemon
Copy link
Member

teolemon commented Aug 7, 2022

Some server side work is going on at https://github.com/openfoodfacts/openfoodfacts-search

@M123-dev
Copy link
Member

M123-dev commented Sep 9, 2022

Server side autocomplete is about to be deployed to staging, perfect opportunity to test it in the dev mode, openfoodfacts/openfoodfacts-server#5006

What P does this have @teolemon

@M123-dev M123-dev removed this from the V2 milestone Nov 6, 2022
@teolemon teolemon added ✨ enhancement New feature or request P4 labels Nov 11, 2022
@teolemon
Copy link
Member

@teolemon teolemon removed the ✨ enhancement New feature or request label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 💬 To discuss and validate
Development

No branches or pull requests

4 participants