---
title: Enum
slug: cms-12/docs/enum
docTags: 
createdAt: 2026-08-10T15:56:03.000Z
---

Use filters to narrow down search results, or use them for database-like queries.

You can use the `Filter` method to filter `enum` and nullable `enum` fields in several ways, as shown in the following use cases and examples.

:::hint{type="info"}
**Note**
Currently, there is support only for filtering by exact matching of values for `enums`. That is, bitwise comparison for `enum` types that have the `Flags` attribute is not baked into the `Match` method but must be done explicitly.
:::

## Match by value

For exact matching, use the `Match` method. The following search matches blog posts whose `PublishState` property is a specific `enum` value. The LINQ equivalent is `Where(x => x.PublishState == PublishState.Published)`.

```csharp
var searchQuery = client.Search<BlogPost>()
    .Filter(x => x.PublishState.Match(PublishState.Published));
```

## Exists

To search for documents where an `enum` field has a value, use the `Exists` method. The following search finds blog posts that have an `Approved` property with a value. In other words, the following code is similar to the LINQ query `Where(x => x.PublishState.HasValue)`.

```csharp
var searchQuery = client.Search<BlogPost>()
    .Filter(x => x.PublishState.Exists());
```
