Modern Search: Syntax & Tokenization

Episode #339 • Sep 22, 2025 • Subscriber-Only

We round out modern search by diving into FTS5’s query syntax language. We’ll learn how it works, how to escape terms sent directly by the user, and we’ll introduce SwiftUI search tokens that can refine a query by term proximity and tags.

Collection
Full-Text Search
Modern Search: Syntax & Tokenization
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

Stephen

The search functionality of our reminders app is really starting to shine. Not only are we using SQLite’s FTS5 module to provide advanced searching capabilities, including ranking, term highlighting and term snippets, but we are even able to leverage all of this work to make our queries more efficient across the board. Even for queries that have nothing to do with searching.

We’re getting close to the end of this series, and we’ve already covered so many things that we didn’t plan on when we started. But that’s just because of how incredible and powerful the FTS5 module is. And there’s still one more thing we want to cover.

Brandon

It turns out that the text we feed to the MATCH operator is not just a simple string, but has a query syntax all of its own. It supports logical operators, such as AND, OR and NOT, it supports NEAR searches so that if someone searches for “New York City” you can you require those all 3 of those words be somewhat near each other instead of scattered all about in the document. And more.

Let’s explore these powers and see how we can leverage them to build an advanced search interface into our reminders app.

FTS query syntax


References

Downloads

Sample code

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 73 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing