directus-extension-typesense
v1.1.0
Published
Typesense search engine features for directus.
Maintainers
Readme
directus-extension-typesense
Integrates Typesense with Directus.
- 😌 Easy to setup and opt-out again. No additional tables/data structure needed.
- 🔒 Keeps your data secure as it adds content to the search index based on a policy (public policy by default).
- 🌐 Supports multilingual content by adding translated fields to index collection.
- 🪨 Handles bulk data imports/updates.
Getting started
- You will need a running Typesense instance.
- Install this extension (for now only made for use on self-hosted instances).
- Configure directus to use typesense by setting the
TYPESENSE_URLandTYPESENSE_SECRETenvironment variables.
Minimal example using docker compose:
# Dockerfile
FROM directus/directus
USER root
RUN corepack enable
USER node
RUN pnpm install directus-extension-typesense# docker-compose.yml
services:
directus:
platform: linux/amd64
build:
context: ./
ports:
- 127.0.0.1:8055:8055
environment:
ADMIN_EMAIL: [email protected]
ADMIN_PASSWORD: d1r3ctu5
EXTENSIONS_AUTO_RELOAD: true
DB_FILENAME: /directus/database/db.sqlite
TYPESENSE_URL: "http://typesense:8108"
TYPESENSE_API_KEY: "secret"
typesense:
platform: linux/amd64
image: typesense/typesense:29.0
ports:
- 127.0.0.1:8108:8108
volumes:
- ./typesense-data:/data
environment:
TYPESENSE_API_KEY: "secret"
TYPESENSE_DATA_DIR: "/data"
TYPESENSE_ENABLE_CORS: truePolicy based indexing
By default this extension will check the public policy to decide whether data will be added to the search index or not. You can change this though by setting the TYPESENSE_POLICY environemnt variable to the id of the policy you want it to respect.
Multilingual content
If you setup content translations, this extension will fetch the translations and add them as localised fields to the documents.
// GET <typesense_url>/collections/article/documents/1
{
"id": 1,
"title_en": "No one is illegal",
"title_es": "Nadie es ilegal",
"title_fa": "هیچ انسانی غیرقانونی نیست"
}Future goals
- [ ] Respect more fine-grained field permissions
- [ ] Refactor in order to have dedicated operations to manually control index building
- [ ] Sorting of fields
