Search by

hamaka / silverstripe-typesense

criedstra

Full-page Typesense search for Silverstripe CMS, with an instant-search overlay. Built on elliotsawyer/silverstripe-typesense.

Package info

github.com/hamaka/silverstripe-typesense

Type:silverstripe-vendormodule

pkg:composer/hamaka/silverstripe-typesense

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.1 2025-10-09 15:03 UTC

This package is auto-updated.

Last update: 2026-10-19 12:56:01 UTC


README

Full-page Typesense search for Silverstripe CMS 5. The module indexes each page as a visitor sees it, so content from elements, blocks and templates is searchable too, not only the Content field. It also ships an instant-search overlay that shows results while you type.

It is built on top of elliotsawyer/silverstripe-typesense, which provides the Typesense client, the collection models and the CMS admin.

Search overlay with instant results

How this differs from elliotsawyer/silverstripe-typesense

elliotsawyer/silverstripe-typesense This module
What gets indexed Database fields you configure per collection The rendered page as plain text (FullPage), plus Title and URL
Keeping the index up to date Sync task / queued jobs Automatic upsert on publish, delete on unpublish or when Show in search is off, plus its own sync task
Frontend None Instant-search overlay (InstantSearch.js), ?q= in the URL with back-button support, GA4 / Tag Manager / Matomo events
Local development — _local collection suffix so local and production indexes don't mix

The admin for collections, fields and synonyms is still the one from Elliot Sawyer's module. This module turns his sync task off and replaces it with TypesenseSyncTaskHmk.

Requirements

  • PHP 8.0+
  • Silverstripe CMS 5
  • A running Typesense server
  • jQuery and the Bootstrap d-none utility class on the frontend (used by the overlay, see Frontend search)

Installation

composer require hamaka/silverstripe-typesense

Then run vendor/bin/sake dev/build flush=1.

Quick start

  1. Add the environment variables to your .env:

    TYPESENSE_API_KEY="your-admin-api-key"
    TYPESENSE_SERVER="https://typesense.example.com:443"
    TYPESENSE_SEARCH_KEY="your-search-only-api-key"
  2. Define a collection: copy _config/typesense.yml.example to app/_config/typesense.yml and give it a unique name.

  3. Build the index:

    vendor/bin/sake dev/tasks/TypesenseSyncTaskHmk
  4. Add the overlay to your template and load the script:

    <% include TypesenseSearchOverlay %>
    <button class="js-search-open">Search</button>
    
    <script src="$resourceURL('hamaka/silverstripe-typesense:client/dist/javascript/bundle.js')"></script>
    <script>
      document.addEventListener('DOMContentLoaded', () => {
        new TypesenseInstantSearch({ indexName: 'your-collection' });
      });
    </script>

From then on, every publish updates the index.

Documentation

  • How it works: how pages are rendered and turned into searchable text
  • Configuration: environment variables, collections, DOM clean-up
  • Frontend search: the overlay, JavaScript usage, analytics, known limitations
  • Development: building the JavaScript bundle, releases

Changelog

See Releases for the changes in each version.

Credits and license

This module is released under the MIT license.

It depends on elliotsawyer/silverstripe-typesense by Elliot Sawyer, licensed under LGPL-3.0 with attribution. src/Tasks/TypesenseSyncTask.php is derived from that module's sync task and keeps its original copyright header.