cmsig/seal-loupe-adapter
Loupe adapter for the SEAL search engine: write indexed documents into a Loupe SQLite instance. Install via Composer and configure through code or a loupe:// DSN (e.g., loupe://var/indexes/). Part of the cmsig/search project.
cmsig/seal-loupe-adapter) integrates with SEAL (Search Abstraction Layer), a PHP CMSIG initiative for decoupling search engine implementations (e.g., Elasticsearch, Algolia, SQLite). This aligns well with Laravel’s need for flexible, vendor-agnostic search solutions, especially for projects requiring lightweight or offline-capable search (e.g., internal tools, prototypes, or SQLite-backed CMS).ServiceProvider (e.g., SealServiceProvider) to register the Engine instance with the container.match(), filter()) maps cleanly to Laravel’s Eloquent-like syntax, easing adoption..env DSN (e.g., SEAL_CONNECTION=loupe://var/indexes/), aligning with Laravel’s conventions.sqlite driver). No additional extensions needed.file, redis) for query results or index snapshots.config('search.use_loupe')) for safe rollout.analyzer configurations to optimize tokenization.ScoutEngine wrapper or use SEAL directly in models.class LoupeScoutEngine extends ScoutEngine {
public function search($query) {
return $this->sealEngine->search($query)->toArray();
}
}
var/indexes/) be versioned and deployed (e.g., Docker volumes, shared storage)?DB::select() or third-party SDKs with SEAL’s DSL.Engine as a singleton:
// app/Providers/SealServiceProvider.php
public function register() {
$this->app->singleton('seal.engine', function ($app) {
$loupeFactory = new \Loupe\Loupe\LoupeFactory();
$adapter = new \CmsIg\Seal\Adapter\Loupe\LoupeAdapter(
new \CmsIg\Seal\Adapter\Loupe\LoupeHelper($loupeFactory, storage_path('app/indexes'))
);
return new \CmsIg\Seal\Engine($adapter, $app['config']['search.schema']);
});
}
config/search.php:
'connections' => [
'loupe' => [
'driver' => 'loupe',
'path' => storage_path('app/indexes'),
'options' => [
'analyzer' => 'default',
],
],
],
class Post extends Model {
public function scopeSearch($query, $term) {
$results = app('seal.engine')->search($term, Post::class);
return $query->whereIn('id', $results['ids']);
}
}
class LoupeScoutDriver extends ScoutDriver {
public function search($query) {
return app('seal.engine')->search($query, $this->model)->get();
}
}
cmsig/seal and cmsig/seal-loupe-adapter.phpunit tests for query accuracy).var/indexes/ (e.g., storage:link + cloud storage).sqlite driver suffices; no additional PECL extensions.cmsig/seal is compatible with your Laravel version (check SEAL’s requirements).chmod -R 775 storage/app/indexes).composer require cmsig/seal cmsig/seal-loupe-adapter.config/database.php (if not using default).How can I help you explore Laravel packages today?