Configure an attribute for textual relevance
Textual relevance refers to how strong a potential match is compared to the visitor's search query. When you configure textual relevance, you tell Sitecore Search where in your content item it needs to look for matching terms and the relative importance it needs to give different content areas.
For example, you might want Search to look for search terms in the values of the title attribute, the description attribute, or somewhere else.
This walkthrough describes how to:
Add a new attribute for textual relevance
To add an attribute and enable it for textual relevance:
-
On the menu bar, click Administration > Domain Settings.
-
Click Attributes > Add Attribute.
-
In the attribute editing dialog, click Settings > Entity and then click the entity that this attribute applies to. Available entity options depend on your specific implementation.
-
In the Display Name field, enter a display name for the attribute.
For example, enter Keywords.
-
In the Attribute Name field, enter the attribute's key or property name. This value is used later in the source configuration.
For example, enter keywords.
-
In the Placement drop-down menu, click Standard.
-
In the Data Type drop-down menu, click the data type of the attribute.
For example, click Array of strings.
-
Optionally, enter values in the following following input fields:
Default Value, Description, and Icon.
-
On the Use For Features tab, select the Textual relevance option.
-
To add the new attribute, click Save. Then, click Publish. In the dialog box that opens, to confirm your changes, click Publish again.
Configure textual relevance at the domain level
To configure textual relevance at the domain level:
-
On the menu bar, click Administration > Domain Setting > Feature Configuration.
-
Click Textual Relevance > Add Attribute
. -
In the selector that opens, click Add
next to the attribute you want to use for textual relevance, and then click Add.NoteYou see that Search adds the Multi-Locale Standard Analyzer by default. Optionally, you can select other analyzers.
-
At the top-right of the page, click Save.
Enable the attribute for textual relevance in the global widget
Now that you've configured the textual relevance feature, you'll need to enable this attribute in the global widget.
To enable the attribute for textual relevance in the global widget:
-
On the menu bar, click Global Resources > Global Widget > Global Widget Settings > Textual Relevance.
-
Click Advanced Mode.
In the advanced mode, you can assign values for the weights of different attribute/analyzer combinations. In the basic mode, you can only use integers to do a simple ranking of attributes.
-
To include an attribute, click Include.
-
In the WEIGHT column, assign a weight to the attribute.
For example, enter 3.
NoteThe value of WEIGHT is an arbitrary number. What matters is how it compares to the weights you give to other attributes.
As a best practice, do not assign a single attribute a weight of more than 5 in order to avoid heavily skewing the algorithm towards that attribute.
-
Click Save.
-
Click Publish.
Extract the new attribute
After you configure an attribute to be used for textual relevance, you'll need to extract values for the attribute in all sources that this attribute applies to.
The process of extracting attribute values depends on the type of source you configured and the type of original content you have. In this example, assume you have a web crawler source and want to use HTML meta tags to extract the attribute's value.
To extract the new attribute:
-
On the menu bar, click Sources and select the source you want to edit to extract values for the new attribute.
-
To get the latest attribute list, on the Source Settings page, click reindex.
-
To extract attribute values, click Edit
next to Attribute Extraction. -
On the Attribute Extraction page, click Add Attribute
. -
In the attribute selector, click Add
next to the attribute whose value you want to extract, and then click Add at the bottom.For example, click author_name.
-
Next to the attribute you want to configure, in the Type drop-down menu, click Meta Tag
-
In the VALUE field, enter the name of the meta tag or property tag you want to use.
For example, if you enter author, Search first constructs this XPath expression:
//meta[@name='author']/@content. If this expression gives a value, Search stops. If this expression does not give a value, Search then constructs this XPath expression://meta[@property='author']/@content.-
Search first constructs this XPath expression:
//meta[@name='author']/@content. If this expression gives a value, Search stops.If this expression does not give a value,
-
Search then constructs this XPath expression:
//meta[@property='author']/@content.
-
-
Click Save.
Verify your configuration
Now that you've extracted attribute values, we recommend that you verify your source configuration.