---
title: "Skip indexing a column in SQLite FTS5"
url: https://recursiveai.org/onelite/cookbook/index-selected-text-columns-with-fts5/
description: "Mark a SQLite FTS5 column UNINDEXED in C# to keep labels and other text in search results without letting that text match full-text queries."
version: "1.0.0"
---

# Skip indexing a column in SQLite FTS5

**OneLite** is a free, open-source SQLite-compatible database for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneLite) · [GitHub](https://github.com/recursive-ai-oss/onelite-csharp) · [Docs](https://recursiveai.org/onelite/docs/) · [Download example (.zip)](https://recursiveai.org/onelite/cookbook/index-selected-text-columns-with-fts5/index-selected-text-columns-with-fts5.zip)

Use `fts5(body, label UNINDEXED)` to search the body and return the label without indexing its words.

```shell
dotnet add package RecursiveAI.OneLite
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using RecursiveAI.OneLite;

await using var db =
    await Database.OpenAsync(":memory:");
await db.ExecuteAsync($"""
    CREATE VIRTUAL TABLE notes
    USING fts5(body, label UNINDEXED)
    """);
await db.ExecuteAsync($"""
    INSERT INTO notes VALUES
    ('Fix the bicycle', 'workshop')
    """);
Console.WriteLine(
    await db.ScalarAsync<string>($"""
    SELECT label FROM notes
    WHERE notes MATCH {"bicycle"}
    """));
```

The snippet prints `workshop`. The download also searches for `workshop` itself.

Unzip [the example](https://recursiveai.org/onelite/cookbook/index-selected-text-columns-with-fts5/index-selected-text-columns-with-fts5.zip), then `dotnet run`.

```text
bicycle matches: 1
Stored label: workshop
workshop matches: 0
```

## The full program

The download searches both `bicycle` and `workshop`. The first term matches the body and returns the stored label. The second term appears only in `label`, so `MATCH` returns no rows, not an error.

```csharp
using RecursiveAI.OneLite;

await using var db =
    await Database.OpenAsync(":memory:");
await db.ExecuteAsync($"""
    CREATE VIRTUAL TABLE notes
    USING fts5(body, label UNINDEXED)
    """);
await db.ExecuteAsync($"""
    INSERT INTO notes VALUES
    ('Fix the bicycle', 'workshop')
    """);

foreach (var term in new[] { "bicycle", "workshop" })
{
    var labels = await db.QueryAsync<string>($"""
        SELECT label FROM notes WHERE notes MATCH {term}
        """);
    Console.WriteLine($"{term} matches: {labels.Count}");
    foreach (var label in labels)
        Console.WriteLine($"Stored label: {label}");
}
```

```text
bicycle matches: 1
Stored label: workshop
workshop matches: 0
```

## Variations

To look up the label itself, use SQL equality instead of `MATCH`. Replace the query inside the loop with this one.

```csharp
var labels = await db.QueryAsync<string>($"""
    SELECT label FROM notes WHERE label = {term}
    """);
```

```text
bicycle matches: 0
workshop matches: 1
Stored label: workshop
```

## Related recipes

- [Create a SQLite FTS5 index and rank matches](https://recursiveai.org/onelite/cookbook/sqlite-full-text-search/)
- [Get SQLite FTS5 match snippets in C#](https://recursiveai.org/onelite/cookbook/generate-sqlite-fts5-search-snippets/)

## The short answer

Add `UNINDEXED` to the column declaration in `CREATE VIRTUAL TABLE … USING fts5(...)`. In `fts5(body, label UNINDEXED)`, `body` supplies searchable words while `label` supplies a value you can select. FTS5 won’t return a row just because a search term appears in the label.

## How do you exclude a field from SQLite FTS5 search?

Use `UNINDEXED` when a field should never contribute to full-text matches. A display label, source URL, or external ID can still travel with the search result without affecting which rows appear. Put the keyword on each column you want to exclude; it is a [column option](https://sqlite.org/fts5.html#the_unindexed_column_option), not a switch on the entire FTS5 table. [OneLite’s FTS5 documentation](https://recursiveai.org/onelite/docs/fts5/#what-is-covered) lists `UNINDEXED` and column filters separately because they solve different problems.

If a field should be searchable on some screens but not others, leave it indexed and restrict each query that needs a narrower search. For example, `body MATCH ?` searches only the body. That restriction changes the current query, not what FTS5 stores in the index.

## Can you filter on an unindexed FTS5 column?

Yes. `UNINDEXED` affects the full-text index, not whether ordinary SQL can read the stored value. In the example, `label = 'workshop'` still finds the row. That expression compares the whole value instead of looking for a word within a longer label. An equality filter can be combined with `MATCH`: use one to filter on the stored label and the other to search the body. If metadata lookup is a main access path, consider an ordinary table with a regular SQL index for that metadata.

## What is stored in an FTS5 table?

By default, FTS5 keeps both the original values and a separate index of searchable tokens. `UNINDEXED` skips the index entries, not the stored value. This recipe uses the default content storage. An [external-content FTS5 table](https://sqlite.org/fts5.html#external_content_tables) reads values from a separate table instead, and the application must keep the index in sync with that table.
