---
title: "Beyond FTS5: Building Transactional Full-Text Search in TursoDB"
description: "TursoDB adds native full-text search by embedding Tantivy and implementing its Directory trait on top of Turso's B-tree, storing index \"files\" as 512KB chunks in an internal table."
url: "https://swe.quest/articles/beyond-fts5-building-transactional-full-text-search-in-tursodb-07e8d5e009fddab8"
canonical: "https://turso.tech/blog/beyond-fts5"
source: "Turso"
published: "2026-01-27"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 7
tags: ["search","storage-engines","sqlite","rust"]
---

# Beyond FTS5: Building Transactional Full-Text Search in TursoDB

A post on [Turso](https://swe.quest/sources/turso.md), published 2026-01-27, 7 min read, Deep dive. Original: [https://turso.tech/blog/beyond-fts5](https://turso.tech/blog/beyond-fts5)

## Summary

TursoDB adds native full-text search by embedding Tantivy and implementing its Directory trait on top of Turso's B-tree, storing index "files" as 512KB chunks in an internal table. Because of this design, index updates share the SQL transaction, WAL, rollback and single-file storage, and indexes are created with Postgres-style \`CREATE INDEX ... USING fts\` syntax with configurable tokenizers, BM25 column weights, MATCH and highlighting. A hybrid cache keeps metadata resident, caches hot small files (term dictionaries, fast fields) whole, and lazy-loads large segment data by chunk. Background merges conflict with single-writer transactional storage, so automatic merging is disabled via NoMergePolicy. An explicit \`OPTIMIZE INDEX\` command handles compaction, similar to VACUUM or ANALYZE.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [Storage engines](https://swe.quest/tags/storage-engines.md) (Data & databases)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [Rust](https://swe.quest/tags/rust.md) (Languages)

## Prerequisites

- SQLite basics ([easy posts on SQLite](https://swe.quest/tags/sqlite.md?difficulty=easy))
- full-text search and BM25 ([easy posts on Search](https://swe.quest/tags/search.md?difficulty=easy))
- B-tree storage and WAL ([easy posts on Storage engines](https://swe.quest/tags/storage-engines.md?difficulty=easy))

## Keywords

TursoDB, Tantivy, FTS5, SQLite, BM25, OPTIMIZE INDEX, NoMergePolicy

## Related posts

- [Turso v0.5.0](https://swe.quest/articles/turso-v0-5-0-1bc59038f4941e8d.md): Turso · 2026-03-04 · Hard · 6 min read · SQLite, Storage engines, Query engines, Consistency models, Search
  Turso v0.5.0 promotes MVCC-based concurrent writes (BEGIN CONCURRENT, adapted from Hekaton) to beta.
- [Anatomy of a (Postgres) search engine](https://swe.quest/articles/anatomy-of-a-postgres-search-engine-ef0fff51702b4f16.md): PlanetScale · 2026-09-22 · Medium · 12 min read · Search, PostgreSQL, Data structures, Storage engines
  Inverted indexes power full-text search by mapping each term to a sorted, compressed postings list of document IDs, with optional positional data for phrase/span queries and frequency statistics for BM25 scoring.
- [Comparing Native Postgres, ElasticSearch, and pg\_search for Full-Text Search](https://swe.quest/articles/comparing-native-postgres-elasticsearch-and-pg-search-for-full-text-search-b83c564af59c02c3.md): Neon · 2025-06-13 · Medium · 9 min read · Search, PostgreSQL, Performance engineering
  Native Postgres full-text search (tsvector/tsquery with GIN indexes) breaks down at scale because ranking by ts\_rank must score every matching row and lacks BM25, fuzzy matching and per-field relevance.
- [Postgres Full Text Search vs the rest](https://swe.quest/articles/postgres-full-text-search-vs-the-rest-f34d597d7fad8021.md): Supabase · 2022-10-14 · Medium · 11 min read · PostgreSQL, Search, Performance engineering, SQLite
  Postgres built-in full text search, using a generated tsvector column with a GIN index and websearch\_to\_tsquery, performs close to dedicated engines like Typesense, MeiliSearch, OpenSearch and SQLite FTS5 in default configurations on a small movie dataset.
- [Introducing Real-Time Data with Materialized Views in Turso](https://swe.quest/articles/introducing-real-time-data-with-materialized-views-in-turso-ac2055a02552eb51.md): Turso · 2025-10-09 · Medium · 4 min read · SQLite, Query engines, Stream processing, Databases
  Turso adds experimental Live Materialized Views to its SQLite-compatible database, using Incremental View Maintenance based on the DBSP framework so views update in time proportional to the size of changes rather than the base tables.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
