PHPackages                             considbrs-webdev/typesense-search - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. considbrs-webdev/typesense-search

ActiveWordpress-plugin[Search &amp; Filtering](/categories/search)

considbrs-webdev/typesense-search
=================================

Typesense Search Plugin for WordPress and Municipio

054↓85%PHP

Since Feb 25Pushed 1mo agoCompare

[ Source](https://github.com/Considbrs-Webdev/typesense-search)[ Packagist](https://packagist.org/packages/considbrs-webdev/typesense-search)[ RSS](/packages/considbrs-webdev-typesense-search/feed)WikiDiscussions dev Synced 3w ago

READMEChangelogDependenciesVersions (14)Used By (0)

Typesense Search
================

[](#typesense-search)

A WordPress plugin that integrates [Typesense](https://typesense.org) as the search back-end for WordPress sites running the [Municipio](https://getmunicipio.com) theme. It keeps a Typesense collection in sync with your WordPress content in real-time and exposes a configurable front-end search UI.

- **Author:** Consid Borås AB
- **License:** MIT
- **Requires:** WordPress 5.6+, PHP 8.1+

---

Table of contents
-----------------

[](#table-of-contents)

1. [What the plugin does](#1-what-the-plugin-does)
2. [Requirements](#2-requirements)
3. [Installation](#3-installation)
4. [Settings](#4-settings)
    - [4.1 PHP constants](#41-php-constants)
    - [4.2 Connection tab](#42-connection-tab)
    - [4.3 Settings tab (content)](#43-settings-tab-content)
    - [4.4 Facetting tab](#44-facetting-tab)
    - [4.5 Quick search tab](#45-quick-search-tab)
    - [4.6 Statistics tab](#46-statistics-tab)
    - [4.7 Status tab](#47-status-tab)
5. [Per-post controls](#5-per-post-controls)
6. [WP-CLI commands](#6-wp-cli-commands)
7. [How indexing works](#7-how-indexing-works)
    - [7.1 Architecture overview](#71-architecture-overview)
    - [7.2 Services layer](#72-services-layer)
    - [7.3 IndexingHooks](#73-indexinghooks)
    - [7.4 IndexingRegistry](#74-indexingregistry)
    - [7.5 IndexingStrategyInterface](#75-indexingstrategyinterface)
    - [7.6 IndexableDocument](#76-indexabledocument)
    - [7.7 Built-in strategies](#77-built-in-strategies)
    - [7.8 DocumentBuilder and the filter chain](#78-documentbuilder-and-the-filter-chain)
    - [7.9 Enrichers](#79-enrichers)
8. [Extensibility](#8-extensibility)
    - [8.1 Add or transform fields via DocumentBuilder filters](#81-add-or-transform-fields-via-documentbuilder-filters)
    - [8.2 Register a custom WordPress strategy](#82-register-a-custom-wordpress-strategy)
    - [8.3 Index external content](#83-index-external-content)
    - [8.4 Customise hit templates](#84-customise-hit-templates)
9. [WordPress hooks and filters reference](#9-wordpress-hooks-and-filters-reference)

---

1. What the plugin does
-----------------------

[](#1-what-the-plugin-does)

- Connects to a self-hosted or cloud Typesense instance.
- Automatically indexes WordPress posts (any post type), pages, and PDF files into a single Typesense collection whenever content is published, updated, unpublished, trashed, or deleted.
- Provides a configurable search page UI (Instantsearch-based) that supports faceting, pagination, hit highlighting, and result truncation.
- Provides a **quick-search** overlay that attaches to configurable CSS selectors on the front-end.
- Exposes WP-CLI commands for bulk indexing, dry-run previews, and index maintenance.
- Is designed to be extended: add fields to existing documents via WordPress filters, write custom indexing strategies for new content types, or index content from **external sources** (APIs, feeds, third-party systems) alongside WordPress content.

---

2. Requirements
---------------

[](#2-requirements)

RequirementNotesWordPress5.6+ (`wp_after_insert_post` hook)PHP8.1+ (union types, `readonly`, named arguments)Typesense serverAny self-hosted instance or Typesense Cloud`pdftotext` binaryOptional — required only for PDF indexingWP-CLIOptional — required only for CLI commands---

3. Installation
---------------

[](#3-installation)

1. Clone or copy the plugin into `wp-content/plugins/typesense-search/`.
2. Run `composer install` inside the plugin directory to install the PHP client.
3. Run `npm ci && npm run build` to compile front-end assets.
4. Activate the plugin from **Plugins** in the WordPress admin.
5. Navigate to **Settings → Typesense Search** and fill in the Connection tab (see §4).

---

4. Settings
-----------

[](#4-settings)

The settings page is at **Settings → Typesense Search** and is split into six tabs.

---

### 4.1 PHP constants

[](#41-php-constants)

All five connection settings can be overridden by defining PHP constants before WordPress loads the plugin. The recommended place is a dedicated config file included from `wp-config.php` (e.g. `wp-content/config/typesense.php`). This is the standard pattern in Municipio/Helsingborg-stad setups.

When a constant is defined:

- Its value is used **instead of** whatever is stored in the WordPress database.
- The corresponding field in **Settings → Connection** is rendered **read-only** so it cannot accidentally be overwritten from the UI.
- Any form submission that would change the value is silently a no-op.

#### Supported constants

[](#supported-constants)

ConstantWordPress optionDescription`TYPESENSE_HOST``typesense_search_remote`Full URL to the Typesense server`TYPESENSE_FRONTEND_HOST``typesense_search_frontend_host`Optional public host sent to the browser`TYPESENSE_COLLECTION``typesense_search_index_name`Name of the Typesense collection`TYPESENSE_ADMIN_KEY``typesense_search_admin_key`Full-access Admin API key (server-side only)`TYPESENSE_SEARCH_KEY``typesense_search_search_key`Search-only key passed to front-end JavaScript#### Setup

[](#setup)

Create a config file (e.g. `wp-content/config/typesense.php`) and include it from `wp-config.php`:

```
