marko/docs-fts
Lightweight lexical search driver for Marko documentation, implementing DocsSearchInterface with SQLite FTS5 (BM25 ranking). Zero model, zero external services — it builds a single SQLite file from the marko/docs-markdown content and queries it. It’s the recommended docs search driver: fast keyword search with no machine-learning dependencies.
docs-fts is a driver for the marko/docs contract. Install one docs driver; binding two implementations of DocsSearchInterface at once is a binding conflict, the same as installing two database drivers.
Installation
Section titled “Installation”composer require marko/docs-ftsRequires ext-pdo_sqlite.
Build the index
Section titled “Build the index”marko docs-fts:buildReads every page from marko/docs-markdown and writes a docs.sqlite FTS5 index (a docs_fts virtual table with porter unicode61 tokenizer, plus a docs_meta companion table). Rebuilds idempotently.
Search
Section titled “Search”module.php binds DocsSearchInterface to FtsSearch, so inject the contract:
use Marko\Docs\Contract\DocsSearchInterface;use Marko\Docs\ValueObject\DocsQuery;
$results = $search->search(new DocsQuery('routing middleware', limit: 10));Implements the full DocsSearchInterface: search() (BM25-ranked DocsResult list with highlighted excerpts), getPage(), listNav(), and driverName() (fts). Throws DocsException when the SQLite file is missing or the source has zero pages.
Related Packages
Section titled “Related Packages”marko/docs— the search contractmarko/docs-markdown— the content it indexes