New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

filagora/filagora-search

Engine-agnostic search for Filagora: a SearchEngine contract, Meilisearch and database engines, indexing and health commands.
1,030
Install
composer require filagora/filagora-search
Latest Version:v0.2.7
PHP:^8.4
Laravel:11 · 12 · 13
License:MIT
Last Updated:Nov 26, 2026
Links: GitHub  ·  Packagist
Maintainer: zcwilt

Search for Filagora that does not tie you to one engine. It defines a SearchEngine contract and a portable filter tree, ships a Meilisearch engine and a database fallback, and keeps the index fresh and healthy with commands. Requires filagora/filagora-core.

The package is at 0.1: the API may change between 0.x minor versions. There is no frontend: you build the search pages.

What it provides

Overview

Engine-agnostic search for Filagora: a SearchEngine contract, Meilisearch and database engines, indexing and health commands.

Tables

This package adds no tables of its own.

Commands

Command What it does
filagora:search:backfill Send one group of fields of every searchable row to the engine as a partial update.
filagora:search:check-health {--index=*} Compare each search index with its expected document count and look for failed indexing tasks.
filagora:search:reindex Send every searchable row of the search indexes to the engine.
filagora:search:sync-settings {--index=*} Apply the search index settings to the engine.

Events

This package fires no events.

Access

This package defines no abilities.

Using it

How it fits together
  • A package (or your app) registers a SearchIndex: one kind of thing, how a model becomes a Document, and a fallback() that answers the same query from the database.
  • You search through Search: app(Search::class)->search('threads', new SearchQuery('paypal', $filter)). It returns ids; you load the rows and drop anything the index describes wrongly (an index is only as fresh as its last sync).
  • The engine is filagora-search.engine: database (the default; no server), array (tests), or one you add with SearchEngines::extend(). If the engine throws, searches are answered from the database for circuit.cooldown_seconds and the failure is logged.
  • Filters are engine-neutral: new All(new Equals('forum_id', 3), new Range('reply_count', gte: 2)).
Keeping the index fresh

Saving, deleting or restoring a model that belongs to a registered index updates its document (after the transaction commits). Set FILAGORA_SEARCH_QUEUE=true to do that on the queue. Failures are logged and never break the save.

php artisan filagora:search:sync-settings            # create indexes and apply their settings
php artisan filagora:search:reindex --flush          # send every searchable row
php artisan filagora:search:reindex --index=threads --from-id=5000 --batch-size=200 --sleep-ms=50
php artisan filagora:search:backfill threads filters # one field group, as partial updates
php artisan filagora:search:check-health             # counts and failed tasks; non-zero on a problem

An index with no searchable fields is searched by vector only. While it has no vector length (its provider is switched off) it is left as it is: nothing is sent to it, sync-settings and reindex skip it (--flush included), and the health check passes over it, whatever it still holds. A row that is deleted is still removed from it. When it is switched on again, apply its settings and fill it, since rows saved in the meantime were not sent.

filagora:doctor also reports the engine's health. With the database engine all of these say there is nothing to do.

Using Meilisearch
FILAGORA_SEARCH_ENGINE=meilisearch
MEILISEARCH_HOST=http://localhost:7700
MEILISEARCH_KEY=your-key

The engine speaks Meilisearch's HTTP API directly. Changes are applied by Meilisearch after it has answered, so a failure shows up as a failed task; syncSettings() waits for its own tasks and MeilisearchEngine::waitForTasks() waits for the rest. Every word of a query must match unless the query asks for MatchingStrategy::Last, which Meilisearch answers by dropping words from the end until something matches (other engines still require every word); a total that reaches meilisearch.max_total_hits (1000, Meilisearch's counting limit) is reported with totalIsCapped.

Writing an engine

Implement Filagora\Search\Contracts\SearchEngine, register it, and run the conformance checks in your tests. If your engine applies writes later, pass a closure that waits until it has caught up:

foreach (EngineConformance::checks($engine, fn () => $engine->waitForTasks()) as $name => $check) {
    it("conforms: {$name}", $check);
}

Requirements

PHP 8.4, Laravel 13 and Filament 5. Tested against MariaDB 11.4. Requires filagora/filagora-core.

Install

composer require filagora/filagora-search

Nothing to migrate: the package owns no tables. It uses the database engine until you set FILAGORA_SEARCH_ENGINE. Packages that have searchable things (forums, cms) register their own indexes when this package is installed.

Configuration

config/filagora-search.php is merged with the host's copy, so list only what differs. Publish it with php artisan vendor:publish --tag=filagora-search-config.

Extending

Extend through documented contracts, events and registries. Anything not documented is @internal.

Testing

composer test

Tests run against a real MariaDB, never SQLite, so engine behaviour (FULLTEXT, ONLY_FULL_GROUP_BY, collation) matches production. Host and credentials come from your environment; the database is always named testing, never your development one.

Local development (DDEV)

.ddev/ is included. ddev start creates both db and testing (run ddev restart once if testing is missing), then ddev exec vendor/bin/pest.

Licence

MIT. See LICENSE.

Related Packages

fauzie811/filament-list-entry

List Entry for Filament Infolist

24,899 15
thiktak/filament-simple-list-entry

Simple List Entry for Infolist

7,420 22
inerba/filament-db-config

A Filament plugin for database-backed application settings and editable content,...

25,746 38
filagora/filagora-core

Filagora core: module registry, settings and shared support for the Filagora Fil...

2,021 0

Version History

Version Released PHP License
v0.2.7 ^8.4 MIT
v0.2.6 ^8.4 MIT
v0.2.5 ^8.4 MIT
v0.2.4 ^8.4 MIT
v0.2.3 ^8.4 MIT