If you’re already a Hitchhiker, log in to access this content.
Entity Sorting Overview| Hitchhikers Platform
What You’ll Learn
In this section, you will learn:
- Refresher on the default sorting methods
- What is entity sorting and what are the options to customize it?
What is Entity Sorting?
Entity Sorting is the ability to manage the order in which the entities appear within a vertical.
In Answers, sorting consists of two main components: 1) the default sort order, specified in the Search configuration file and 2) optional client-side sorting. We’ll first discuss how to control the default sort order, and then review how to add client-side sorting, to allow your users to re-order their results.
The Answers configuration has a default sorting built into the backend that does not require any setup called “Relevance” sorting, which we learned about in the Overview of the Answers Algorithm track.
As you may recall, the algorithm has a few components to make up the ranking logic but the main ones are 1) Location Radius with Location Intent 2) Relevance and 3) Location Distance.
However, we also have the ability to customize sorting in a couple of ways, should you want to adjust the order of the entities beyond relevance for a particular vertical. You’ll learn how we can do this in this module.
What are the customizable sorting options?
There are four main sort options that are supported and we will show you how to implement these:
- Random Relevance (RELEVANCE_RANDOM)
- Distance (ENTITY_DISTANCE)
- Ascending or Descending of a custom field (“FIELD”)
As noted above, Relevance is our standard sorting (without the sorting on distance). By default, the algorithm will score based on Relevance.
Random Relevance: This is an addition to standard sorting that introduces randomization to the sorting. If two results have the same quality text match, the entities will be sorted randomly per session. Random relevance cannot be combined with the relevance sorting method.
Distance: This is the distance from the users location or the users intended location.
However, sometimes, sorting by distance is too literal. For example, if one location is 500 feet closer than another location, that trivial distance hardly matters to the user. At that point, results should instead be sorted by relevance. The Bucketed Distance feature converts a continuous distance value into a discrete range, making it easier to sort by both distance and relevance.
By a custom field: Any field can be used to sort results. We support number, date, and boolean fields. Text fields are supported for A-Z or Z-A sorting. As part of the configuration, you also need to specify the field and as well as the order it should be sorted: either ascending (triggered by “ASC) or descending (triggered by “DESC”).
What is a default sort order?
The default sort order is the order in which results return for a specific vertical. An Administrator can add a default sort order to the Answers Search Configuration file. Each sorting option can be added under the relevant Knowledge Graph vertical in the configuration.
Note that sorting is applied per vertical and isn’t applied uniformly across all verticals. For example, an administrator for a Financial Services client could apply random sorting to the Advisors vertical or Distance sorting to the Location Branches vertical but neither option would be applied globally across all of the verticals.
What is client-side sorting?
As mentioned, there are two different ways of controlling sorting. You can control the default sorting (via the Search Configuration file) as we discussed above. You can also expose sorting options to the users in Vertical Search. This is set up as part of the Answers front end and allows an end user to adjust the sorting algorithm, which we refer to as client-side sorting or “SortOptions” in the configuration.
For example, in product search, you could expose the following sorting widget or the search results page:
We’ll show you in the next unit how to implement sorting both in the backend and in the frontend but first, let’s look at some common use cases for why to implement these.
Common Use Cases for Sorting Options
There are a number of use cases for sorting entities that can arise for an Administrator. At times, it can be beneficial to only use one sorting option and at other times, to combine sorting options among the available verticals for the best results.
Let’s look at a few common use cases:
- Randomizing “people” results may help avoid unfairness and preferential treatment towards one person over another
- Sorting people based on both availability (Custom Field) and Distance
- Sorting entities by promotion or release date in combination with relevance
- Sorting entities by Price (Custom Field) — high to low or low to high — in combination with “Relevance”
These use cases can be particularly applicable in the following industries:
|Financial Services||Randomizing “bankers” or “financial advisors” results to avoid unfairness and preferential treatment towards one person over another.|
|Retail||If new products are released and should be promoted, you can sort by relevance and a release date to prefer those to the top. If some products are more or less expensive than others, you can sort products by price and by relevance to the query|
|Food Services||If you want menu items that are more expensive to be at the top, by relevance to the query and price custom field in descending order|
|Healthcare||Preferring doctors who accept new patients over those that do not.|
Can you think of some other use cases? Submit them to the community here!