---
title: Pinned results in the C# SDK
slug: cms-13/docs/pinned-results
docTags: 
createdAt: 2026-07-30T20:22:05.862Z
---

[Pinned results](docId\:PaScZgTEgFyb9hSRR3G1O) promote specific content items to the top of search results when a query matches a configured phrase. Use pinned results to highlight important pages for common or high-value searches.

Configure pinned items in Optimizely Graph using the Graph management API. The C# SDK does not create pinned items. Instead, use `.WithPinned()` in a query to include them in the results.

## Add pinned results to a query

Call `.WithPinned()` in a query that uses `.SearchFor()`. The phrase passed to `.SearchFor()` retrieves matching pinned items.

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .SearchFor("GRAPH API")
    .UsingFullText()
    .WithPinned()
    .GetAsContentAsync();
```

Pinned items display at the top of the results list. Other results follow based on their relevance score.

## Override the pinned phrase

Use the `phrase:` parameter when the display query differs from the phrase used to configure pinned items.

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .SearchFor("graph api tutorial")
    .UsingFullText()
    .WithPinned(phrase: "graph api")
    .GetAsContentAsync();
```

In this example, the user typed `graph api tutorial`, but the query matches pinned items configured for `graph api`.

## Limit pinned results to a collection

Restrict pinned items to a specific collection. Only pinned items that belong to the specified collection appear at the top of the results.

```csharp
var collectionId = Guid.Parse("YOUR_COLLECTION_ID");

var result = await client
    .QueryContent<BlogPostPage>()
    .SearchFor("graph api")
    .UsingFullText()
    .WithPinned(collectionId: collectionId)
    .GetAsContentAsync();
```

## Combine pinned results with other query methods

Pinned results work with other query operations such as filters, pagination, and total counts.

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .SearchFor("graph api")
    .UsingFullText()
    .Where(x => x.BlogCategory == "Tutorials")
    .WithPinned()
    .Skip(0)
    .Limit(10)
    .IncludeTotal()
    .GetAsContentAsync();
```

Pinned items always display first in the result set. Non-pinned items follow according to their calculated relevance.

`.WithPinned()` requires a search query. If the query does not include `.SearchFor()`, pinned results are not applied.
