Open BijanT opened 4 years ago
I agree completely, filtering needs to be intelligent and productive. I will take this if nobody else feels strongly.
I think I echo a lot of the same thoughts but I'll try to list them below.
price: Like you're saying @BijanT, we should return a set of restaurants that have a price equal to, or lower than the lowest-price filter. i.e. person 1 passes $$, person 2 passes $, person 3 passes $$. we apply and return anything with a price of $ or less, because person 2 is unwilling to pay more money, but certainly persons 1 and 3 would be okay with paying less.
distance: the exact same logic applies as above, lowest distance is king
rating: the opposite logic applies because everyone likely wants to eat at the best restaurant possible, so we can return anything with a rating equal to, or higher than the highest rating listed.
we could also be intelligent about these. for example, 3 people are okay with a 4 star restaurant, but a single person lists 5 stars as their rating preference. let's say that 5 star rating completely depletes the set of returned restaurant; i.e. it is incompatible. we can then try applying the next best rating, in this case 4 stars. if we return restaurants using this second chance approach, we can let the users know what we did and why we did it.
also @NiharikaTomar, @BenHolzem, and @jkuzminski7, do any of you have opinions on UI changes to reflect this? what if we used sliders instead of text based inputs for these options? i.e. something conceptually like this:
cuisine: we could make better use of logical operators when applying cuisine preferences. currently, any queries using different cuisines results in a queryset of size 0 which is useless. this one might be more tricky to think about, but we can definitely use an OR operator when applying multiple cuisine filters per user. we could also crawl the preferred cuisine filters list and see if any users have any cuisine preferences in common and prioritize those. just a few ideas.
definitely interested in thoughts on these thoughts
Currently, in the backend it seems like for the filtering of the price and rating filters, restaurants need to be exactly the same as what was given to pass the filter. I think it makes much more sense to pass all restaurants that have a higher rating than what is requested in the request. Similarly, it should pass restaurants that have a lower price than what is requested.
For similar reasons, I think each person filling out filters should only be able to select one price and one rating.