Sometimes, sorting by distance is too literal. For example, if one location is 500 feet closer than another location, that hardly matters to the user. At that point, results should instead be sorted by relevance. With the September Release, the Bucketed Distance feature converts a continuous distance value into a discrete range, making it easier to sort by both distance and relevance.
For example, you might configure your distance buckets like so:
{
"sortBys": [
{
"type": "ENTITY_DISTANCE",
"buckets": [
8046.72, // 5 miles
80467.20, // 50 miles
160934.00 // 100 miles
]
},
{
"type": "RELEVANCE"
},
{
"type": "ENTITY_DISTANCE"
}
]
}
In the UI, a new â€śBucketsâ€ť column has been added to the Sorting Rule section:
This example configuration would instruct the Answers experience to first sort by which distance bucket the location falls in, then by relevance, and then finally, by continuous distance.
- Bucketed Distance: The algorithm first sorts by bucketed distance. In this example, the admin has made three buckets - one for 5 miles, 50 miles, and 100 miles (N.B. distances must be expressed in meters). This means the algorithm first shows all locations within 5 miles - even if theyâ€™re less relevant - then locations within 50, then locations within 100.
- Relevance: Next, the algorithm sorts on relevance. So if there are two locations that are both within 5 miles, the algorithm will sort them on relevance instead of distance. It doesnâ€™t matter if one is 4 miles away and the other is 3 miles away.
- Distance: Finally, the algorithm sorts on (continuous) distance. This means that if two locations are in the same distance bucket and are equally relevant, then it will sort them based on the exact distance. Continuous distance would be used a tiebreaker.
Here is how an example result set would look, given this sorting:
Distance Bucket | Relevance Score | Exact Distance | Ranking |
---|---|---|---|
< 5 miles | 3 | 1 mi | 1 |
< 5 miles | 3 | 3 mi | 2 |
< 5 miles | 2 | 0.5 mi | 3 |
< 5 miles | 2 | 1.5 mi | 4 |
< 5 miles | 1 | 1 mi | 5 |
< 5 miles | 1 | 2 mi | 6 |
< 50 miles | 5 | 25 mi | 7 |
< 50 miles | 1 | 20 mi | 8 |
< 50 miles | 1 | 25 mi | 9 |
< 50 miles | 1 | 40 mi | 10 |
To learn more about sorting, visit the Sorting Answers training module.
Bucketed Distance will now be visible in Hitchhikers and Playground Accounts. To turn on this feature in your Production account, you can fill out this form.