flair icon indicating copy to clipboard operation
flair copied to clipboard

Feasible recipes are not at the top?

Open felciano opened this issue 2 years ago • 4 comments

Thanks for a cool site. If I understand the front page description correctly, shouldn't one see more feasible recipes at the top of the list once one starts checking ingredients? If I check "Raspberry liqueur", the first 6 recipes are still fully infeasible, and the first recipe with "Raspberry liqueur" doesn't show up until search result #7. Seems to me that any recipe with at >=1 of the checked ingredients should appear higher in the list than recipes with 0 of the checked ingredients.

I note that the description says they will move "closer to the top" so maybe this is as expected, but I'm wondering if this is as intended/designed, or a side effect of some implementation component.

felciano avatar Feb 11 '22 17:02 felciano

This is the method that calculates how to sort non-makable recipes:

https://github.com/tmcw/flair/blob/304ac4609ac00fde8156ea0e9a6607d354c6c07a/front/src/Main.elm#L556-L564

It takes into account how many ingredients the recipe has, not just which are available - so, for example, if you have "Raspberry liqueur", but none of the three other ingredients for a French Martini, you need 3 extra ingredients to make the martini, but only 2 extra ingredients to make a vodka martini (which just has two ingredients).

Though, this has come up a bunch so this obviously isn't the behavior people are expecting, and something that biases cocktails that use ingredients rather than just the gap, is probably a good idea.

tmcw avatar Nov 28 '22 20:11 tmcw

I guess you'd want to weight "having an ingredient" higher than "not having an ingredient" like it is rn?

ex, each owned ingredient = 1.25, each unowned ingredient = -1

vodka martini = -2 french martini when owning raspberry liqeur = 1.25 - 3 = -1.75

french martini ranked higher..

presumably some weight there would make sense?

jasikpark avatar Nov 28 '22 23:11 jasikpark

Not sure I understand how it is supposed to work today. For example, here I've selected just one Material (Tequila), which has moved Margarita up to the 2nd place position, with 2 unowned ingredients. However the #1 and #3 spot both have only 2 ingredients, neither of which are Tequila. This doesn't make intuitive sense to me.

CleanShot 2022-11-28 at 15 43 23@2x

I would have expected drinks with Tequila to show up above any drinks with no Tequila. Is that not your intuition?

From there, I'd expect "the more ingredients I have, the higher the drink will score", at which point the gap size logic could be used to further sort (i.e. the drinks with the fewer missing ingredients score higher than drinks with more missing ingredients).

felciano avatar Nov 28 '22 23:11 felciano

The more I think about it, the more I think you'll need a lexical sort at some point. For example, if you select "Tequila" and "Dark Rum", recipes that have either ingredient show up in what appears to be an arbitrary order. One would expect all the "recipes with Tequila as an ingredient" to be clustered together, and the "recipes with Dark Rum as an ingredient" similarly. Presumably the Dark Rum cluster would precede the Tequila ones based on alphabetical ordering

felciano avatar Nov 28 '22 23:11 felciano