cmsig/seal-redisearch-adapter
RediSearch adapter for the SEAL search engine. Index and query documents in a Redis Stack instance using RediSearch + RedisJSON. Supports ext-redis/ext-json and DSN-based configuration; note: no GeoBoundingBox or HIGHLIGHT support.
"We’re proposing to replace our current search provider [X] with RediSearch, an open-source, high-performance alternative built on Redis. Here’s why this makes sense for [Company]:
- Cost Savings: Eliminate ~$Y/year in search provider fees while maintaining (or improving) performance.
- Speed: Achieve sub-100ms response times for search queries, critical for [use case, e.g., checkout conversion, user engagement].
- Infrastructure Synergy: Leverage Redis, which we already use for caching/sessions, reducing operational complexity.
- Future-Proofing: Avoid vendor lock-in by using open-source tech with a unified search abstraction layer (SEAL).
- Risk: Limited to basic search today, but we can phase in advanced features (e.g., geo-search) later as needed. Ask: Approve a 4-week POC to validate performance with our live dataset and compare it to our current solution."*
"This SEAL + RediSearch combo lets us:
- Unify search across all Laravel apps using a single abstraction layer, reducing duplication.
- Leverage Redis we already use, simplifying ops and reducing infrastructure sprawl.
- Avoid custom search code—SEAL handles indexing, queries, and schema management out of the box. Key Trade-offs:
- No geo/highlighting yet (track SEAL issues), but we can implement workarounds or switch backends later.
- Requires
ext-redisandext-jsonPHP extensions (already used in [Project X]). Next Steps:
- Benchmark RediSearch against our current search backend (e.g., Algolia, database full-text).
- Validate schema migration effort for our top use cases (e.g., products, articles).
- Propose a phased rollout starting with non-critical features."*
"To integrate RediSearch with SEAL in Laravel:
- Install Dependencies:
composer require cmsig/seal cmsig/seal-redisearch-adapter- Configure Redis:
- Ensure your Redis server has the RediSearch and RedisJSON modules enabled.
- Update Laravel’s
config/database.phpto include the Redis connection:'redis' => [ 'default' => env('REDIS_CONNECTION', 'redis'), 'redis' => [ 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), ], ],- Set Up SEAL:
- Define your schema (e.g.,
app/Search/Schemas/ProductSchema.php):use CmsIg\Seal\Schema; return Schema::create() ->addTextField('name') ->addNumericField('price') ->addTagField('category');- Initialize the engine in a service provider:
use CmsIg\Seal\Engine; use CmsIg\Seal\Adapter\RediSearch\RediSearchAdapter; use Illuminate\Support\Facades\Redis; $this->app->singleton('search.engine', function () { return new Engine( new RediSearchAdapter(Redis::connection()), require __DIR__.'/Schemas/ProductSchema.php' ); });- Index Data:
- Use SEAL’s CLI or a Laravel command to index existing data:
use App\Models\Product; use Illuminate\Support\Facades\Bus; Product::chunk(100, function ($products) { Bus::dispatch(new IndexProducts($products)); });- Query Search:
- Example in a controller:
use Illuminate\Support\Facades\App; $results = App::make('search.engine')->search('query')->get();Gotchas:
- Redis Modules: Double-check that
redisearchandredisjsonare loaded in your Redis config (redis.conf).- Schema Design: SEAL’s schema must match your Laravel models. Use accessors or observers to transform data before indexing.
- Performance: For large datasets, consider async indexing (e.g., Laravel queues) to avoid timeouts. Feedback: This is early-stage—file issues in SEAL’s repo for missing features or edge cases."*
"This package supports our goals to:
- Reduce cloud costs by moving search in-house (aligned with [Cost Optimization Initiative]).
- **
How can I help you explore Laravel packages today?