Sorting search results by relevance
To help you organize search results, you can sort them based on how relevant they are to your search criteria. This means that those most relevant to your search are displayed at the top of the search results list.
When generating search results, Sitecore Content Hub:
- Reduces the number of search result candidates by applying the search criteria you define.
- Scores and ranks search results. The first step is to apply the search criteria and reduce the number of search candidates. This step outputs all assets that match the defined search or filter criteria.
In the second step, Content Hub calculates and assigns a score to each asset in the candidate set. This score reflects how relevant the asset is for the defined query. After the relevancy score is assigned to assets, the search results are sorted and ranked.
Content Hub uses the BM25 best matching algorithm to calculate relevancy. This algorithm uses three factors to determine each asset score as described in the following table.
|Term frequency (TF)||This refers to the number of times the search term is repeated in the asset fields. The more often it is repeated, the more relevant the asset is. For example, the Winter cookbook and the Classic Cocktails recipe book are both assets in Content Hub:|
|Inverse document frequency (IDF)||This refers to the number of assets that contain the search term. The higher the number of assets, the less important that term is. For example, consider the Winter cookbook and the Classic Cocktails recipe book from the previous example along with eight more assets in the same context:|
|Field length||This means that if an asset contains the search term in a field with a shorter length, it is likely more relevant than an asset that contains the same term in an extended field. For example, the Winter cookbook has a description of 350 characters while the Classic Cocktails recipe book has a description of 1200 characters:|
Boosting an asset
You can influence how an asset is ranked in search results by boosting an asset.
Consider the following example. The superuser adds two fields to the schema for M.Asset:
- Information About Author
On the Author field, the superuser enables the boost property.
If the user uploads two cookbooks both written by Sara Dubler and adds the following:
- Summer Salads cookbook - adds the name of the author in the Author field and leaves the other field blank.
- Mediterranean Salads cookbook - leaves the Author field blank but adds information about Sara Dubler in the Information About Author field.
Then, a search for Sara Dubler brings up the Summer Salad cookbook and lists it first because it has Sara Dubler in the Author field and this field is boosted in comparison with the Information about Author field.
The boost feature and search support wildcard searches if enabled in the Search component.
Can we improve this article ? Provide feedback