Download the PHP package ralkage/flarum-ext-search without Composer
On this page you can find all versions of the php package ralkage/flarum-ext-search. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ralkage/flarum-ext-search
More information about ralkage/flarum-ext-search
Files in ralkage/flarum-ext-search
Package flarum-ext-search
Short Description Meilisearch-backed full-text search for Flarum: typo tolerance, prefix matching, post-content search, highlighted snippets, queued indexing.
License MIT
Informations about the package flarum-ext-search
Better Search
Meilisearch-backed full-text search for Flarum. Drop-in replacement for Flarum's default MySQL LIKE-based search, adding typo tolerance, prefix matching, instant fuzzy matches, per-field weighting (title > content), and proper relevance ranking.
What you get
- Typo tolerance: "wellcom" finds "Welcome", "annoucement" finds "Announcement".
- Searches inside replies: a query that matches only the 14th post in a long thread now surfaces that discussion. Default Flarum search would miss it.
- Highlighted post snippets in the search dropdown: the matching post (not just the first) shows beneath each result.
- Tag-aware visibility: Meilisearch-side filtering against the actor's visible tags. Flarum's normal
whereVisibleTostill gates final results, so nothing leaks. - Live updates: every post create/edit/hide/delete reindexes via a queued job. With Flarum's default
syncdriver it runs inline (no setup); switch to Redis/database for real async.
Requirements
- Flarum
^1.8 - A reachable Meilisearch instance (
^1.0)
Install
Enable in Admin → Extensions → Better Search.
Run a Meilisearch instance. Docker is the easiest path:
For production, set MEILI_MASTER_KEY=<long-random-string> and pass it in the admin settings page.
Build the initial index:
Or click Rebuild index now on the settings page.
Configuration
All settings live on the admin extension page:
| Setting | Default | Purpose |
|---|---|---|
| Host URL | http://127.0.0.1:7700 |
Meilisearch HTTP endpoint. |
| API key | (empty) | Master key or scoped key. Leave blank in development. |
| Index prefix | flarum |
Distinguish staging/prod on a shared Meilisearch instance. |
| Max hits per query | 500 |
Upper bound on results pulled per index per query. |
How it works
Two Meilisearch indexes (<prefix>_discussions, <prefix>_posts) are kept in sync via event listeners. When a user searches, the gambit queries both indexes, merges the discussion IDs (title hits first, content hits second), and populates most_relevant_post_id so Flarum's existing dropdown can render the matching post snippet automatically.
Async indexing
Live updates are dispatched as Flarum\Queue\AbstractJob instances. Out of the box they run on the sync driver (inline). To move them off the request path, point Flarum at a real queue (e.g. database/Redis) in config.php:
and run a worker: php flarum queue:work.
Console
Rebuilds both indexes from MySQL. Safe to run at any time. It re-upserts; documents never leave the indexes unless explicitly deleted.
License
MIT. See LICENSE.