openfoodfoundation / openfoodnetwork

Connect suppliers, distributors and consumers to trade local produce.
https://www.openfoodnetwork.org
GNU Affero General Public License v3.0
1.11k stars 718 forks source link

Include Variant Name in Product Search #1232

Closed lin-d-hop closed 7 years ago

lin-d-hop commented 7 years ago

Product Variants can have names that hold key information about the product. As an example: Product: Homemade Icecream Variant: Chocolate Variant: Strawberry Variant: Vanilla Variant: Chocolate chip

In the current implementation if a customer inputs 'Chocolate' they would not see the Chocolate Icecream. And really they should.

As a customer, I search for products If the search term is contained in a product name/producer/taxon

As a customer, I search for products If the search term is contained in a variant name, but not the product name/producer/taxon

1) Search Icecream Display: Product: Homemade Icecream Variant: Chocolate Variant: Strawberry Variant: Vanilla Variant: Chocolate chip

2) Search Chocolate Product: Homemade Icecream Variant: Chocolate Variant: Chocolate chip

We'd like the list of filtered products to contain the results searching upon Product Name AND Producer AND Taxon AND Variant Name.

Edit: Changed the quiche flavours into icecream flavours... hunger does not result in clear issue specification when it comes to food products :-)

OliverUK commented 7 years ago

I certainly wouldn't be fussed if a search for "goats cheese" returned all the quiches in this example though of course your suggestions is much more elegant, Lynne.

Also I think there are some better examples why this is really important. For example I have a product called "speciality cheeses" shown below. A search for "feta", "mozarella, "brie" or "recotta" wouldn't return anything.

screen shot 2016-11-25 at 12 33 29

Equally my listing for "beef" which has as variants all sorts of steaks and other cuts wouldn't come up if you searched for "steak", "sirloin" or "topside". screen shot 2016-11-25 at 12 36 10

I feel these illustrate a bit better than the quiche that this can make a huge difference.

lin-d-hop commented 7 years ago

@OliverUK Thanks for the additional examples. It is easy to argue here that these examples use variants in a way that they are not intended to be used. If that was the decision the onus would be on you to make all of these variants separate products. I chose the example such that this would not be seen to the case, as the user guide suggests variants can be used for different flavours of the same product. I would suggest that you could argue different cheeses and steaks are different products, not sizes or flavours of the same product.

OliverUK commented 7 years ago

@lin-d-hop That's a fair point but the shop front looks infinitely tidier since I've started using variants in this way. You can imagine, with sometimes 800+ variants live, it makes a big difference. But I do see your point.

lin-d-hop commented 7 years ago

A better ux of the shopfront is a great reason to use variants in that way. Nice point @oliveruk

Matt-Yorkley commented 7 years ago

Is that an additional issue to be addressed, as well as the search results? It seems like grouping lots of different products all together as variants of a single product is probably not a good idea in general, but if it currently improves the UX then maybe we need a solution that provides something similar aesthetically without actually grouping them together. A kilo of steak and half a kilo of ribs are not really variants. Mozzarella is not Stilton!

On the search results issue, if there's a match in a variant it seems like it would make the most sense to just return that variant? Like if there's 20 flavours of quiche, and only one is "mushroom" and I search for "mushroom", I don't expect to see 19 other types of quiche that aren't relevant to my search.

lin-d-hop commented 7 years ago

@Matt-Yorkley see ongoing conversation about shopfront display here: https://community.openfoodnetwork.org/t/shopfront-display/676/26

In the meantime searching variant name in the product search is a good enhancement to make :-)

Matt-Yorkley commented 7 years ago

Ready for testing: screenshot from 2016-11-28 21-55-15 I should get a gold star for that one, it was really tricky.

NickWeir63 commented 7 years ago

Thanks @Matt-Yorkley - this is a great improvement.
Is it ready for testing on UK staging?

lin-d-hop commented 7 years ago

Hi @stveep @levent Would either of you be able to review @Matt-Yorkleys changes in PR #1241 ? Thanks!

lin-d-hop commented 7 years ago

@Matt-Yorkley Could you explore test coverage and adding specs here too? Cheers mate!

Matt-Yorkley commented 7 years ago

Done.

OliverUK commented 7 years ago

@lin-d-hop Deployed to UK staging and tested from Safari on Mac.

screen shot 2016-12-20 at 16 20 26 screen shot 2016-12-20 at 16 20 42

The search still includes the category name so that for example a search for "jam" will return anything sat within the category "jams and spreads". Not part of this code change of course but just to mention it.

OliverUK commented 7 years ago

I was curious if the search would feel sluggish with this change because more data is included but on increasing the OC to 360 variants it still performed the same as with just a few items.

lin-d-hop commented 7 years ago

Thanks Oliver!

sstead commented 7 years ago

Looks fine in Aus staging, ready for production.