Note: This is part of the
cmsig/search
project create issues in the main repository.
Integration of the CMS-IG — Search Engine Abstraction Layer (SEAL) into Spiral.
Note: This project is heavily under development and any feedback is greatly appreciated.
Use composer for install the package:
composer require cmsig/seal-spiral-bridge
Also install one of the listed adapters.
The following adapters are available:
- MemoryAdapter:
cmsig/seal-memory-adapter
- ElasticsearchAdapter:
cmsig/seal-elasticsearch-adapter
- OpensearchAdapter:
cmsig/seal-opensearch-adapter
- MeilisearchAdapter:
cmsig/seal-meilisearch-adapter
- AlgoliaAdapter:
cmsig/seal-algolia-adapter
- SolrAdapter:
cmsig/seal-solr-adapter
- RediSearchAdapter:
cmsig/seal-redisearch-adapter
- TypesenseAdapter:
cmsig/seal-typesense-adapter
- ... more coming soon
Additional Wrapper adapters:
- ReadWriteAdapter:
cmsig/seal-read-write-adapter
- MultiAdapter:
cmsig/seal-multi-adapter
Creating your own adapter? Add the seal-php-adapter
Topic to your Github Repository.
The following code shows how to configure the package:
<?php
// app/config/cmsig_seal.php
return [
'schemas' => [
'app' => [
'dir' => 'app/schemas',
],
],
'engines' => [
'default' => [
'adapter' => 'meilisearch://127.0.0.1:7700',
],
],
];
A more complex configuration can be here found:
<?php
// app/config/cmsig_seal.php
return [
'schemas' => [
'app' => [
'dir' => 'app/schemas/app',
'engine' => 'meilisearch',
],
'other' => [
'dir' => 'app/schemas/other',
'engine' => 'algolia',
],
],
'engines' => [
'algolia' => [
'adapter' => 'algolia://' . env('ALGOLIA_APPLICATION_ID') . ':' . env('ALGOLIA_ADMIN_API_KEY'),
],
'elasticsearch' => [
'adapter' => 'elasticsearch://127.0.0.1:9200',
],
'meilisearch' => [
'adapter' => 'meilisearch://127.0.0.1:7700',
],
'memory' => [
'adapter' => 'memory://',
],
'opensearch' => [
'adapter' => 'opensearch://127.0.0.1:9200',
],
'redisearch' => [
'adapter' => 'redis://[email protected]:6379',
],
'solr' => [
'adapter' => 'solr://127.0.0.1:8983',
],
'typesense' => [
'adapter' => 'typesense://[email protected]:8108',
],
// ...
'multi' => [
'adapter' => 'multi://elasticsearch?adapters[]=opensearch',
],
'read-write' => [
'adapter' => 'read-write://elasticsearch?write=multi',
],
],
'index_name_prefix' => '',
'reindex_providers' => [
\App\Search\BlogReindexProvider::class,
],
];
The default engine is available as Engine
:
class Some {
public function __construct(
private readonly \CmsIg\Seal\EngineInterface $engine,
) {
}
}
Multiple engines can be accessed via the EngineRegistry
:
class Some {
private Engine $engine;
public function __construct(
private readonly \CmsIg\Seal\EngineRegistry $engineRegistry,
) {
$this->engine = $this->engineRegistry->get('algolia');
}
}
How to create a Schema
file and use your Engine
can be found SEAL Documentation.
The package provides the following commands:
Create configured indexes
php app.php cmsig:seal:index-create --help
Drop configured indexes
php app.php cmsig:seal:index-drop --help
Reindex indexes
php app.php cmsig:seal:reindex --help