Closed teolemon closed 2 years ago
Part of the problem is that we retrieve 10Kb by product, because we also get all the verbose comments:
And you can note that even when we only retrieve the data from the local database, it takes time. We are too fat!
And that's only one part of the problem.
You ask for 25 products max in your query, and we ask for 500 (!) products: KeywordsProductQuery(keywords: value, size: 500)
And you ask for 7 fields (more or less given the translated fields and so), and following are the 30 fields we ask for (cf. ProductQuery.fields
:
static List<ProductField> get fields => <ProductField>[
ProductField.NAME,
ProductField.BRANDS,
ProductField.BARCODE,
ProductField.NUTRISCORE,
ProductField.FRONT_IMAGE, // is in your query
ProductField.IMAGE_FRONT_SMALL_URL,
ProductField.IMAGE_FRONT_URL,
ProductField.IMAGE_INGREDIENTS_URL,
ProductField.IMAGE_NUTRITION_URL,
ProductField.IMAGE_PACKAGING_URL,
ProductField.SELECTED_IMAGE,
ProductField.QUANTITY, // is in your query
ProductField.SERVING_SIZE,
ProductField.PACKAGING_QUANTITY,
ProductField.NUTRIMENTS,
ProductField.NUTRIENT_LEVELS,
ProductField.NUTRIMENT_ENERGY_UNIT,
ProductField.ADDITIVES,
ProductField.INGREDIENTS_ANALYSIS_TAGS,
ProductField.LABELS_TAGS,
ProductField.LABELS_TAGS_IN_LANGUAGES,
ProductField.ENVIRONMENT_IMPACT_LEVELS,
ProductField.CATEGORIES_TAGS_IN_LANGUAGES,
ProductField.LANGUAGE,
ProductField.ATTRIBUTE_GROUPS,
ProductField.STATES_TAGS,
ProductField.ECOSCORE_DATA,
ProductField.ECOSCORE_GRADE,
ProductField.ECOSCORE_SCORE,
ProductField.ENVIRONMENT_IMPACT_LEVELS,
];
The first step would be to lower the number of requested products from 500 to 25, wouldn't it?
Things would make more sense if we could send the food preferences at query time, and let the server filter / reorder the data before replying it. The end-user would get immediately the best products first.
For the moment we are not able to store paged results: the id of the list is just the keyword. If we want paged results, we need to write some code.
Running both 25 and 500 queries in parallel can be tricky.
I don't know what the personae want, but I know that downloading 500 products for one query would sound crazy. A bit like going to page 50 in google.
Bumping to P0. This is annoying as hell.
So what do you have in mind @teolemon?
In both cases the first 25 products don't mean that much, as they have nothing to do with one's personal ranking parameters. I guess it's the same problem on the website. We'd definitely be better off with the personal parameters being passed to the URL and returning the best 25 products. I don't know how feasible it would be but that would be awesome.
Another solution would be get the first 25 products, which will be good enough to know the total number of products. And say to the user: "we found 25 products that match your search, but there are 653 matches: would you like to get them all?"
@stephanegigandet what do you think ?
I would load the full product on click, and not before.
This has a huge impact IMHO. Let's do this before thinking about the others
Another minimization idea which just came to my mind, we currently request all the fields we show on the product page but it's unlikely everyone needs all of them for ranking.
I for example don't have any big food allergies so for my ranking they can be left out completely.
This of course leads to more complexity but if there is no other way then to query around 500 products for personal search this could make a difference.
@teolemon After several days playing with the new "next 25 products" button, how do you feel? I guess the results are much faster and the UX is acceptable, right?
What
Video
https://user-images.githubusercontent.com/1689815/147953519-794f4ef9-9450-4f3a-9293-4b79ae1be4b8.mp4
Part of
533