Skip to content

[6.x] Add a native Typesense search driver - #15714

Open
jackmcdade wants to merge 2 commits into
6.xfrom
typesense-search-driver
Open

jackmcdade wants to merge 2 commits into
6.xfrom
typesense-search-driver

Conversation

@jackmcdade

@jackmcdade jackmcdade commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Adds Typesense as a built-in search driver alongside Algolia and local search. You can run your own Typesense server or use Typesense Cloud, then use Statamic's existing search tags and query builder.

This includes the usual filtering, sorting, pagination, highlights, and snippets — plus optional semantic search and natural language queries.

Why this over the Rad Pack add-on?

The Rad Pack add-on already gets Statamic talking to Typesense. This brings that integration into core and goes further in a few useful ways:

  • Search stays available during rebuilds. Rad Pack deletes and recreates the collection. This builds a new one, fills it, then swaps an alias over. Synonym and curation sets survive the swap, including ones you've configured through the Typesense dashboard.
  • Filters don't quietly disappear. Rad Pack skips filters and sorts it can't translate. This sends the whole query to Typesense when it can, or filters and sorts locally when it can't. Counts and pagination use Typesense's total rather than counting its default page of results.
  • Less schema babysitting. The schema comes from your configured fields, with metadata like status, site, collection, and date included automatically. You can override field types, facets, and sorting when you need more control. Import failures are reported instead of silently leaving documents out.
  • Semantic and natural language search are built in. Optional auto-embeddings let a query find relevant content without matching the exact words. Natural language search turns a request like “posts about Laravel from last month” into a structured query. Parsed parameters are reused across pages so pagination doesn't ask the LLM to interpret the query again.
  • Frontend search gets scoped keys. {{ search:scoped_key }} generates an expiring search key with published-content and applicable site constraints, so you can query Typesense directly from your frontend.

Existing Rad Pack client and search_options config is supported. Run php please search:update to rebuild an existing index using the new driver.

Setup

Run the interactive installer to choose Local, Algolia, or Typesense:

php please install:search
# Or select a driver and index directly:
php please install:search typesense --index=blog

It installs the SDK, checks your connection, saves credentials in .env, and updates the selected index without replacing its fields or transformers. It can also build the index for you. Semantic search and natural language setup are optional; NL setup supports an existing Typesense model or a new OpenAI model.

For manual setup, Typesense requires version 30+ and composer require typesense/typesense-php:^6.0. Add your connection details to the search driver config, then configure an index:

'blog' => [
    'driver' => 'typesense',
    'searchables' => 'collection:blog',
    'fields' => ['title', 'content'],
],

Semantic search is configured through settings.embedding. Typesense can run its built-in embedding model itself. Natural language search is separately opt-in through ->naturalLanguage() or natural_language="true" and needs an LLM configured on the Typesense server. Neither is implicitly enabled in the Control Panel.

Testing and caveats

Search/tag tests, 16 installer tests, Pint, and PHPStan pass. Tests use mocked HTTP responses; live-server verification is still needed for rebuilds, pagination, scoped keys, and the optional AI features.

Local filtering defaults to 250 candidates. Presets that restrict returned fields must retain reference for result hydration. Grouped results still report group counts. The first migration from a plain collection needs a delete-and-alias step; subsequent alias rebuilds keep search available.

Docs will follow in statamic/docs.

Give Statamic a first-party Typesense index with alias reindexing, pushed-down filters, hybrid embeddings, scoped keys, and optional natural language search.
@jackmcdade
jackmcdade requested a review from a team as a code owner October 23, 2026 19:40
@jackmcdade jackmcdade changed the title Add a native Typesense search driver [6.x] Add a native Typesense search driver Oct 23, 2026

This branch has not been deployed

No deployments
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