---
title: Filter Optimizely Graph results with the C# SDK
slug: cms-13/docs/filtering
docTags: 
createdAt: 2026-07-30T20:22:03.194Z
---

Use `.Where()` to narrow results by field values. The SDK translates standard C# comparison operators into Optimizely Graph filter expressions.

## Filter by string equality

Match content by an exact field value, such as posts by a specific author.

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .Where(x => x.Author == "John Developer")
    .GetAsContentAsync();
```

## Filter by numeric comparison

Compare numeric fields against a threshold to find content above, below, or at a specific value.

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .Where(x => x.ViewCount > 1000)
    .GetAsContentAsync();
```

The supported operators are `>`, `>=`, `<`, `<=`, and `==`.

## Filter by boolean value

Select content based on a true or false property, such as retrieving only featured posts.

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .Where(x => x.IsFeatured == true)
    .GetAsContentAsync();
```

## Filter by date range

Use `&&` to combine lower and upper bounds in a single `.Where()` clause:

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .Where(x => x.StartPublish >= new DateTime(2024, 1, 1) && x.StartPublish <= new DateTime(2024, 12, 31))
    .GetAsContentAsync();
```

## Combine conditions with AND

All conditions in a single `.Where()` lambda combine with AND. Every condition must match:

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .Where(x => x.Author == "John Developer" && x.BlogCategory == "Tutorials" && x.IsFeatured == true)
    .GetAsContentAsync();
```

## Combine conditions with OR

Use `||` inside the lambda to combine conditions with OR. Any one condition matching is enough:

```csharp
var result = await client
    .QueryContent<BlogPostPage>()
    .Where(x => x.BlogCategory == "Tutorials" || x.BlogCategory == "Advanced")
    .GetAsContentAsync();
```

## Combine search with filters

Chain `.Where()` with `.SearchFor()` to narrow full-text search results. See [Search content in Optimizely Graph with the C# SDK](docId\:wkIAHH2c8t0jVgJpquxTS) for details.
