---
title: "Using ranking"
slug: "using-ranking"
abstract: "Learn how to use the Search and Recommendation API for Sitecore Search to perform customized ranking."
---
# Using ranking

You can add custom ranking to change the relevancy of an item in the search results. To perform customized ranking, use the `widget.items.search.ranking` object and specify a `name` and `weight`.

> [!note]
> Before you can use an attribute for ranking, make sure that an administrator configures the attribute for **Ranking** in Search.

For the data model of this object, see the [Search and Recommendation API reference](https://doc.sitecore.com/search/en/developers/search-and-recommentation-api/index.html).

For example, a visitor searches for **product optimization** and you have ten items in the results, each of which has a relevancy score. You can use customized ranking to increase or decrease the relevancy score of each item. If you rank by, say, `review_rating`, items with a greater review rating get a higher relevancy score.

> [!note]
> We recommend that you keep the `weight` to under five. This is to minimize the impact of a single attribute on the overall system.

The higher the `weight`, the more important Sitecore Search considers the attribute when it calculates the relevancy score. For example, if you want Sitecore Search to give slightly more importance to the `review_rating` attribute than to the `genre` attribute, pass both attributes and assign `review_rating` a higher `weight`.

The following code sample shows how to create a request:

```JSON
{
    "widget": {
        "items": [
            {
                "rfk_id": "rfkid_7",
                "entity": "content",
                "sources": [
                    "388218",
                    "390565"
                ],
                "search": {
                    "content": {
                        "fields": [
                            "title"
                        ]
                    },
                    "ranking": [
                        {
                            "name": "review_rating",
                            "weight": 1.7
                        }
                        {
                            "name": "genre",
                            "weight": 1.5
                        }
                    ]
                }
            }
        ]
    },
    "context": {
        "locale": {
            "country": "us",
            "language": "en"
        },
        "user": {
            "uuid": "159871551-1g-i4-4x-1p-f5tdhddqwvywv7b9g2vy-1664852644904"
        }
    }
}
```