---
title: "Configure a sorting option"
slug: "configure-a-sorting-option"
abstract: "How to add the option to sort by top views in Sitecore Search after the initial setup."
---
# Configure a sorting option

By default, in Sitecore Search search results are displayed in descending order by relevancy score, but you can create other [sorting options](https://doc.sitecore.com/search/en/users/search-user-guide/refine-search-results/sorting-options.html "Sorting options"). Similarly, you can sort results using visitor interaction metrics such as most clicked on, most viewed, and so on.

The following procedures describe how you can configure sorting options and sorting criteria.

## Enable the sorting option feature for an attribute

To add an attribute as a new sorting option, you must first ensure the attribute is enabled with the sorting option feature.

To enable the sorting option feature for an attribute:

1. On the menu bar, click **Administration** > **Domain Settings** > **Attributes**.
2. In the **Attributes** tab, in the search box, enter name of the attribute or the attribute containing the inner attribute, and then click on it in the tabular list.
3. In the dialog, on the **Use For Features** tab, select the **Sorting Options** check box.
4. Click **Apply**, then click **Save**.
5. Click **Publish**. Confirm the action when prompted.

## Enable the sorting option feature for an inner attribute

Sitecore Search tracks statistics such as clicks, conversions, views, and searches over time periods ranging from *1 day* to *90 days*. These statistics are stored as inner [attributes](https://doc.sitecore.com/search/en/users/search-user-guide/configure-entities/attributes.html "Attributes") within the *rfk_stats* composite attribute. Sitecore Search uses these attributes internally to generate [analytic reports](https://doc.sitecore.com/search/en/users/search-user-guide/monitor-performance.html "Monitor performance"), but you can also use them on your site as sorting options.

Before adding an inner attribute as a new sorting option, you must enable it as a sorting option feature.

To enable the sorting option feature for an inner attribute:

1. On the menu bar, click **Administration** > **Domain Settings** > **Attributes**.
2. In the **Attributes** tab, in the search box, enter name of the attribute containing the inner attribute, and then click on it in the tabular list.
3. On the left vertical menu bar, click the **Inner Attributes** tab.
4. In the list of inner attributes, click the inner attribute you want to use for sorting. This opens the inner attribute editing dialog.
5. In the dialog, on the **Use For Features** tab, select the **Sorting Options** check box.
6. Click **Apply**, then click **Save**.
7. Click **Publish**. Confirm the action when prompted.

## Add a sorting option

After making an attribute available as a sorting option, you must add it to the sorting options list in order for it to be used on your domain.

To add a sorting option:

1. On the menu bar, click **Administration** > **Domain Setting** > **Feature Configuration** > **Sorting Options**.
2. Scroll to the bottom of the list of sorting options, then click ![plus_add__purple.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/plus_add__purple.png) **Add Sorting Option**.
3. Click **Edit** ![pencil_purple.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/pencil_purple.png) at the top of the new sorting option.
4. In the **SORTING OPTIONS PROPERTIES** dialog, to provide values:
    1. In the **DISPLAY NAME** field, enter a short but descriptive name.

        For example, *Top viewed this week*.

    2. In the **API NAME** field, enter a name for the sorting option without escape characters and then click **Save**.

        For example, *top_viewed_this_week*.

    3. Click **Save**.
5. Optionally, to add a sorting criteria, click ![plus_add__purple.png](https://doc.sitecore.com/api/markdown-image/search/en/users/search-user-guide/images/plus_add__purple.png) **Add Sorting Criteria**.
6. [Edit the sorting criteria](https://doc.sitecore.com/search/en/users/search-user-guide/refine-search-results/configure-a-sorting-option.html#UUID-ab190903-8ff6-1deb-1664-37d4b2c8d9a8_section-idm1743458520411524 "Edit a sorting criteria").
7. Click **Save**, then click **Publish**. Confirm the action when prompted.

> [!important]
> After completing this step, you must [reindex](https://doc.sitecore.com/search/en/users/search-user-guide/refine-search-results/keep-indexes-up-to-date.html "Keep indexes up to date") your content for the new sorting option to be available for use.

## Edit a sorting criteria

After creating a sorting option, you can configure the sorting criteria included in the option. By default, a sorting criteria uses algorithmic sorting and sorts alphabetically ascending.

To edit a sorting criteria:

1. In the **Sorting type** drop-down menu, to sort based on an attribute click *Attribute Sorting* else click *Algorithmic Sorting*.
2. For attribute sorting only, in the **Name/Title** drop-down menu, click attribute.

    For example, to sort by content items' titles, set this to the *title* attribute.

3. In the sorting direction drop-down menu, click *Ascending* or *Descending*.
4. For attribute sorting only, in the analyzer drop-down menu, click *No analyzer* or *Lowercase*.

    The *Lowercase* [analyzer](https://doc.sitecore.com/search/en/users/search-user-guide/optimize-keyword-searches/types-of-analyzers.html "Types of analyzers") transforms text to lowercase before sorting.

5. To publish sorting criteria and all other changes to sorting options, click **Save** and then click **Publish**. Confirm the action when prompted.

> [!important]
> After completing this step, you must [reindex](https://doc.sitecore.com/search/en/users/search-user-guide/refine-search-results/keep-indexes-up-to-date.html "Keep indexes up to date") your content for the new sorting option to be available for use.

## Turn on the sorting option in the global widget settings

If you do not turn on *any* sorting options in the global widget settings, the API returns *all* sorting options created in feature configuration. However, if *any* sorting options are turned on in the global widget settings, only the ones that are turned on are returned by the API.

> [!important]
> We recommend you turn on new sorting options in the global widget. However, if this is not the first sorting option and no other sorting options are turned on, do not complete this step because otherwise, all other sorting options are disabled.

Turning on sorting options in global widget settings allows you to have more control over which sorting options are returned by creating a default configuration that can be overridden at the individual widget level with rules. It also makes it possible to create many potential sorting options in feature configuration and then only turn on the ones you need.

To configure the sorting option in the global widget:

1. On the menu bar, click **Global Resources**, then click **Global Widget**.
2. On the **Global Widget Settings** tab, click the **Sorting** card.
3. On the card for the new sorting option, turn on the switch.
4. Optionally, if you want this sorting option to be the default, click **Make Default**.
5. Click **Save**, then click **Publish**. This opens a dialog. Confirm your changes by clicking **Publish** again in the dialog.

> [!important]
> After completing this step, you must [reindex](https://doc.sitecore.com/search/en/users/search-user-guide/refine-search-results/keep-indexes-up-to-date.html "Keep indexes up to date") your content for the new sorting option to be available for use.