Optimizing search results using the textual relevance feature

After you complete the initial setup of Sitecore Search on your site, you might find that your search results are either incomplete or include irrelevant content items. If this happens, you can fine-tune results by making changes to your textual relevance setup.

If your search results are incomplete, try setting up the textual relevance feature to use more attributes.

Even if your search results are still incomplete after adding targeted attributes, we advise against creating an attribute that represents the full text of your content item, such as the body tag of an HTML-based webpage. Doing this can cause irrelevant search results because the search term might appear in a menu, a sidebar, or even in the HTML tags themselves.

To avoid this, you can create an attribute that precisely targets the text you want to extract. For example, there might be a particular <div> element within the <body> that contains the main text of your article or post. If there is, you can extract the contents of that <div> element instead of the contents of the entire <body> element. This helps ensure that search results are as relevant as possible. Then, when enabling that attribute for textual relevance in the global widget, we recommend that you assign that attribute a lower weight compared to other attributes. This way, content items that have the search term in a more relevant field, like the title, will show up higher in search results compared to content items that only mention the search term in the body text.

Optimizing search results using the textual relevance feature can be an iterative process. After adding a new attribute for use with textual relevance, you might find that your search results have become less relevant. If this happens, you can try decreasing the weight of the attribute. If you are still getting irrelevant search results, you might need to refine your data more or remove the attribute altogether.

Do you have some feedback for us?

If you have suggestions for improving this article,