ernestdefoe/typesense
Composer 安装命令:
composer require ernestdefoe/typesense
包简介
Fast, typo-tolerant Typesense search for Flarum 2 — a free, drop-in search driver.
README 文档
README
A free, drop-in Typesense search driver for Flarum 2 — fast, typo-tolerant full-text search across discussions, users and posts that anyone can set up in a few minutes.
Flarum 2 shipped a pluggable search architecture; this extension implements a Typesense driver for it. Text searches are answered by Typesense; everything else (filtering, browsing, permissions) stays exactly as Flarum does it. You choose per resource which searches Typesense answers.
Why it's safe by design
Typesense is only ever asked for candidate discussion IDs and their ranking. Which
results a given user may actually see is decided entirely by Flarum's own
whereVisibleTo (including tag restrictions) — never by Typesense. The search server
holds no authorization logic, and the browser never talks to it. Your API key is stored
server-side and is never exposed to visitors.
Requirements
- Flarum
^2.0 - A running Typesense server (self-hosted is a single binary or Docker container, or use Typesense Cloud)
Install
composer require ernestdefoe/typesense
Run Typesense (self-hosted example)
docker run -d --name typesense -p 8108:8108 \
-v typesense-data:/data typesense/typesense:27.1 \
--data-dir /data --api-key='CHANGE_ME' --enable-cors
Set up
- Admin → Typesense Search. Enter the host, port, protocol and API key, then Save.
- Click Test connection to confirm Flarum can reach the server.
- Click Rebuild index (or run
php flarum typesense:index) to populate the index from your existing discussions. - Turn on Use Typesense for discussion search and save.
That's it — searches for discussions are now served by Typesense.
Console
php flarum typesense:index # build / refresh the index php flarum typesense:index --flush # delete the index
How indexing works
- Each discussion is one Typesense document: its title plus the concatenated text of its visible comment posts.
- Creating, editing or deleting a discussion or post re-indexes the affected discussion automatically through Flarum's queued indexing pipeline.
- Configure a real queue driver (
redis,database, …) in production so indexing and rebuilds run in the background rather than inline on a web request.
Several forums can share one Typesense server safely — collections are namespaced by a prefix (set one, or it's derived from your forum URL).
What's indexed
Everything Flarum can full-text search, each in its own namespaced collection:
- Discussions — title + the concatenated text of visible comment posts.
- Users — username and display name.
- Posts — individual comment post text (post-scoped search).
Each is toggled independently in the admin, so you can send discussion search to Typesense while leaving users or posts on the database, or run all three through it. (Groups and access tokens have no full-text search in Flarum, so they always stay on the database driver.)
License
MIT © Ernest Defoe
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-02