Reputation: 145
What should be the ideal way of ranking the records holding places, given that we have distance to a point + popularity of the place?
Assume I have the table designed with the following columns:
| PlaceID | Lat/Long | Distance | Popularity |
There are 2 factors to consider here for ranking(sorting) the records: 1. Distance: Sort records by distance in increasing order. 2. Popularity: Sort records by popularity in decreasing order.
How would the ideal way of ranking the places records considering both of these factors to give users a best places-search experience?
Upvotes: 2
Views: 251
Reputation: 3547
You could use many ways. One of the simplest is using a value for the importance of popularity and a value for the importance of distance.
Given a place p you could calculate the importance of the place I(p) by using the popularity P(p) and the distance D(p). You should decide or find the best values for the weights a and b.
I(p) = a * P(p) - b * D(p)
Upvotes: 1