Attributes

In Sitecore Search, attributes represent important metadata in your content items. This metadata is used for performing searches, displaying the results, and collecting analytics. All attributes belong to an entity.

Your content items already have data that can be used by Sitecore Search to optimize and display your search results. Some of the data, such as information that is listed in a meta tag of a website, might be metadata that is specifically tagged for SEO purposes. Other pieces of data exist in the content item itself, like a title in an h1 HTML tag or a description taken from the first paragraph of a PDF.

Some attributes are included by default during domain setup based on the default Content entity, but you must create any custom attributes required to index your data. You can view a list of attributes in the Customer Engagement Console (CEC) by clicking Administration > Domain Settings > Attributes.

After you create attributes for all of the metadata you want to be usable by Sitecore Search, you must set up a source and configure how you want to extract attribute values from the metadata of your content items.

Note

An attribute doesn't have to be present in every content item unless it is marked as required. You can configure whether an attribute is required for all content items when you create or edit an attribute using the CEC.

Composite attributes

Composite attributes are attributes that contain other attributes, called inner attributes. Composite attributes are used to group related attributes together. For example, Search uses a composite attribute, rfk_stats, to group together attributes related to site statistics.

The inner attributes in rfk_stats are also called statistical attributes. They represent data such as 1 Day Views, 7 Days Searches, and 90 Days Clicks.

You can see which attributes are composites by viewing the Data type column in the list of attributes located on the Attributes tab in Domain Settings.

Currently, you can't add new composite attributes. You can edit existing inner attributes. You might do this, for example, if you wanted to add the option to sort by top views.

How Sitecore Search uses attributes

Knowing how Sitecore Search uses attributes can help you decide which metadata you want to create attributes for. Sitecore Search uses attributes in several different ways: to display information about content to visitors, to sort, filter, rank, or recommend content items, and to generate statistics.

For displaying information about content items to visitors

You use attributes such as title and description to display information about your content items to your visitors in search results.

For example, consider the Sitecore.com content item titled Premier Assure services: assuring confidence in your investment.

The attribute values extracted from this content item include the following:

A. Content type: Knowledge Center

B. Title: Premier Assure services: assuring confidence in your investment

C. Description: Premier Assure is designed to follow you in your journey with Sitecore and build programs that follow...

D. Url: https://www.sitecore.com/activities

E. Image: https://wwwsitecorecom.azureedge.net/-/media/sitecoresite/images/home/_/activities/gettyimages-699087272-hero.jpg?md=20220921T172222Z

The following image shows the same attribute values for the content item displayed in the Sitecore.com search results for premier assure services:

 

For sorting, filtering, ranking, and recommending content items

You also use attributes to sort, filter, rank, or recommend content items. For example, in the following image, you can see two attributes being used as facets on the Sitecore search page: Product and Type. Site visitors can filter search results using values for these facets.

 

The following screenshot shows the list of all attributes used on the Sitecore search page with the Product and Type attributes highlighted. You can see from the checkmarks in the Facets and Filters columns that these attributes are enabled for use as facets and filters, which is what makes it possible for site visitors to filter search results using them.

 

For generating statistics

Finally, Sitecore Search provides some default attributes that are used in statistics. These consist of the inner attributes for rfk_stats and include data points such as page views, clicks, conversions, and so on. You can view these values on the Stats tab of any content item in the content item browser in the CEC. These values are also used to generate analytic reports.

Choosing attributes

You have to decide which attributes, if any, you need in addition to the base attributes included in the entity. To do this, consider what metadata is present in your content items and what you want to use that metadata for in your search results.

Anything that you might want to display to visitors in search results or use for filtering, sorting, or recommending is a good candidate for an attribute.

To find metadata to use for attributes, first look at the data that is visible to your visitors. Examine your content items for things like titles, subtitles, descriptions, images, tags, and so on.

Next, examine metadata that is hidden from the user interface. On a website, this usually means viewing the website source and finding the information contained within meta tags.

To determine which pieces of metadata will be useful in your implementation, you can ask yourself the following questions about each of the Sitecore Search features:

  • Facets and filters - what data do you want your visitors to be able to use to narrow their search results? For example, if you use the content type attribute as a facet, your visitors can filter search results by content types such as blogs, tutorials, articles, and so on.

  • Personalization - what data do you want to use to personalize search results? For example, if you use the content type attribute for personalization, a visitor who often reads blogs will be shown more content with the value of content_type set to blog.

  • Search ranking - do you want to boost search results by certain attributes? If so, which ones? Search results are ordered using a calculation that takes into account a variety of factors, including search ranking weights assigned to an attribute in the Global Widget settings. For example, if you use the review_rating attribute for search ranking, content items with higher values for review_rating are given more weight than those with lower values or no value.

  • Sorting options - what data do you want to use to sort search results? For example, if you use the last_modified attribute as a sorting option, your visitors can sort search results by when the content was last modified.

  • Suggestions blocks - what data do you want to use to build suggestions in the search bar? For example, if you use the title attribute for suggestion blocks, suggestions in the search bar are built using title values. This means that if a visitor types the word data into the search bar, suggested terms, such as data processing and data management are generated. Because the title attribute is being used for suggestion blocks, these terms are taken from content titles.

  • Textual relevance - what data do you want to use to determine the relevance of a document to a search? For example, if you use the description attribute for textual relevance, Sitecore Search displays results that include the search term in the description.

Do you have some feedback for us?

If you have suggestions for improving this article,