-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Use the new ElasticSearch endpoint to provide as you type brand suggestions #619
Comments
@alexgarel No language or country parameters? |
Besides, looking for "pizza" I've found a lot of duplicates, which does not make that much sense for autocomplete: [
{
"product_name": "Pizza"
},
{
"product_name": "Pizza"
},
{
"product_name": "Pizza Margherita"
},
{
"product_name": "Pizza"
},
{
"product_name": "Pizza"
},
{
"product_name": "Pizza"
},
{
"product_name": "Pizza"
},
{
"product_name": "Pizza"
},
{
"product_name": "Pizza"
},
{
"product_name": "Pizza"
}
] curl -X 'POST' \
'https://search.openfoodfacts.net/autocomplete' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"response_fields": [
"product_name"
],
"num_results": 10,
"text": "pizza",
"search_fields": [
"product_name",
"brands",
"categories"
]
}' |
Hey, I created that endpoint with the API in mind, which didn't have a strict ranking requirement. I should have some free time next week, will try porting the ranking logic. We also have all of the data needed for a language/country search, so I can make sure that's exposed. |
Hi @simonj222! My Xmas list:
No rush, just ping me when you're done, and thank you! |
Quick update - was hoping to spend time on it this week, but the family got covid and then I'm back at work the week after, so probably won't have time to do this - sorry :( It's worth saying that the current index should be able to serve the following features:
If someone wants to take on these additional features, it shouldn't be too tricky:
This is exposed in several places in the product: https://github.com/openfoodfacts/openfoodfacts-search/blob/main/app/models/product.py - you might have some luck with the StringFilter already.
I think we need to decide on the auto-complete/type-ahead behavior (I currently don't see any type-ahead behavior on https://world.openfoodfacts.org/). Do we want it to:
I suspect we want the latter, in which case I don't think we want de-duplication, but want very aggressive ranking. If we want the former (not actual products), then we probably need to re-think things, but I also think it's less helpful.
I think this is key - probably worth starting off with most popular by views (iirc that's what the current search does, but worth verifying). This is non-trivial since we'd need to update the view counts (this isn't currently stored). So, we'd probably want to:
From here, using it in ranking should be reasonably doable, with some manual tuning to find the right function. |
Thank you @simonj222 for your verbose feedback. I hope everything is now OK for your family, covid-wise. |
@simonj222 @monsieurtanuki It would really be nice to have this one up, in our quest to simplify new product addition |
|
@teolemon I'm not sure it's a good idea to restore the service now, as we are expected to move it quite a lot in next monthes. |
We now have an autocomplete feature deployed in staging, thanks to @Frank Baele ! |
To what extent should we implement this in the Dart package? |
The syntax will not change, nor will the output, the only thing changing is .net to .org when it's deployed to production |
Closed by #835. |
What
Related web feature
Part of
The text was updated successfully, but these errors were encountered: