Skip to content

add sqlite3 fts5 search example; uses the thin sqlite3-ocaml binding - #3698

Open
jonesmelton wants to merge 1 commit into
ocaml:mainfrom
jonesmelton:sqlite_fts_example
Open

add sqlite3 fts5 search example; uses the thin sqlite3-ocaml binding#3698
jonesmelton wants to merge 1 commit into
ocaml:mainfrom
jonesmelton:sqlite_fts_example

Conversation

@jonesmelton

@jonesmelton jonesmelton commented Jun 25, 2026

Copy link
Copy Markdown

Cookbook example for fts5 in sqlite:

  • creates table of basic "notes"
  • minimal seed data to run it
  • external content fts virtual table and triggers to keep it in sync
  • uses sqlite3_ocaml binding

The choice of external content is a little tricky to balance for a small example. Internal content is simpler but not used much in practice because it duplicates the data. Contentless is common but requires manually keeping the index in sync, usually in application code, so not really appropriate for a self-contained example. External content is more complex, requiring triggers, but the logic is simple and all in sqlite. So I went with that.

There is also kind of a "minimal dependencies" vs "idiomatic OCaml" question here. In real code you'd likely use or write a library to handle the fairly low level sqlite stuff, it's a little gnarly having it right in with the queries. But this approach lets it be focused more on what sqlite3 is actually doing, rather than describing how to abstract over queries or showing off the Caqti DSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant