magedevgroup / module-typesense-indexer
Turns the Magento catalog into Typesense documents and owns the attribute→schema policy. Implements Magento's indexer contracts so catalogsearch_fulltext writes to Typesense: FAT documents, THIN schema, in-place flag PATCH instead of full reindex.
Package info
github.com/MageDevGroup-com/module-typesense-indexer
Type:magento2-module
pkg:composer/magedevgroup/module-typesense-indexer
Requires
- php: ~8.3.0||~8.4.0||~8.5.0
- magedevgroup/module-typesense-core: >=0.0.1
- magento/framework: >=103.0
- magento/module-catalog: >=104.0
- magento/module-catalog-inventory: >=100.0
- magento/module-catalog-search: >=102.0
- magento/module-customer: >=103.0
- magento/module-eav: >=102.0
- magento/module-elasticsearch: >=101.0
- magento/module-search: >=101.0
- magento/module-store: >=101.0
Requires (Dev)
- phpunit/phpunit: ^12.0
This package is auto-updated.
Last update: 2026-07-20 08:33:17 UTC
README
Turns the Magento catalog into Typesense documents and owns the attribute → schema policy
(L1 of the Typesense suite). It implements Magento's indexer contracts
(IndexStructureInterface, SaveHandler\IndexerInterface), so the standard
catalogsearch_fulltext indexer writes to Typesense instead of Elasticsearch/OpenSearch.
It is the single writer of catalog collections — typesense-search and any future read model
consume the same documents without forking the pipeline. Depends on magedevgroup/module-typesense-core.
Install
composer require magedevgroup/module-typesense-indexer bin/magento module:enable MageDevGroup_TypesenseIndexer bin/magento setup:upgrade
Add magedevgroup/module-typesense-search to select typesense as the search engine and query it.
Configuration
This module owns the Typesense configuration; core is pure transport and consumes it through
TypesenseCore\Api\ConnectionSettingsInterface.
- Connection — Stores → Configuration → Catalog → Catalog Search, shown when the engine is
typesense(catalog/search/typesense_*: host, port, index prefix, API key, protocol, additional nodes, timeouts, retry, health-cache TTL). The API key is encrypted andsensitive. - Schema policy — MageDevGroup → Typesense → Schema Changes (
rebuild_thresholddefault 500000,decision_overridedefaultauto). - The
magedevgrouptab,magedevgroup_typesensesection andMageDevGroup_TypesenseIndexer::configACL resource are defined here; other suite modules only add their own groups.
FAT documents, THIN schema — why flag changes are cheap
Two facts about Typesense drive the design: a document stores its full JSON on disk including
undeclared keys (only declared fields cost RAM), and a schema PATCH rebuilds the index from the
stored documents — no reimport.
So: write every attribute value into the document regardless of its flags (FAT), but declare
only the fields the flags require (THIN). Native Magento invalidates the whole fulltext index when
a search flag changes — hours on a large catalog. Because the value is already in every document,
this module instead does an in-place schema PATCH (≈0.3s on 50k docs). Toggling is_filterable
makes a facet appear with no reindex — the flagship free feature. A genuinely new attribute still
reindexes (its values are in no document yet); if an in-place PATCH is unsafe or over threshold, the
module falls back to native invalidation rather than leave the schema stale.
Escape hatch: MageDevGroup → Typesense → Catalog Indexing → Reindex on Attribute Change = Yes
(magedevgroup_typesense/indexer/use_native_invalidation, default No) disables the PATCH path.
Reindex model
Reindex builds a fresh collection per store view, imports documents in batches, and swaps the
alias onto it as the final step — zero-downtime. Consumers query the alias
typesense_<indexerId>_<storeId> (e.g. typesense_catalogsearch_fulltext_1); the physical
collection behind it is versioned and swapped atomically.
Extension points
Everything is contributed through di-merged composites — nobody writes a document or PATCHes a
collection directly, and the schema is computed (base + Σ providers), so additions cannot collide.
Model/Schema/FieldProviderInterface—getFields(int $storeId): FieldSpec[], adds schema fields (the seamtypesense-semanticuses for vector fields viaFieldSpec::extra).Model/Document/DocumentDataProviderInterface—addData(array $documents, int $storeId), adds document data; providers chain. Data may be written with no schema field declaring it (FAT).Api/SearchableFieldsProviderInterface—get(int $storeId): arrayreturns field ⇒ query weight, the single source of truthtypesense-searchandtypesense-instant-searchmap ontoquery_by/ their browser config. The query side can never drift from the indexed side.
Register a provider by merging into the matching composite's providers array in di.xml.
Requirements
Magento 2.4.x · PHP 8.3–8.5 · magedevgroup/module-typesense-core.
License
OSL-3.0 © MageDevGroup.