tangniyuqi/yii-module
最新稳定版本:0.2.3
Composer 安装命令:
composer require tangniyuqi/yii-module
包简介
An integration of schranz-search search abstraction via a Module into the Yii Framework.
关键字:
README 文档
README
Schranz Search SEAL
Yii Integration
Integration of the Schranz Search — Search Engine Abstraction Layer (SEAL) into Yii.
Note: This is part of the
schranz-search/schranz-searchproject create issues in the main repository.
Note: This project is heavily under development and any feedback is greatly appreciated.
Installation
Use composer for install the package:
composer require schranz-search/yii-module
Also install one of the listed adapters.
List of adapters
The following adapters are available:
- MemoryAdapter:
schranz-search/seal-memory-adapter - ElasticsearchAdapter:
schranz-search/seal-elasticsearch-adapter - OpensearchAdapter:
schranz-search/seal-opensearch-adapter - MeilisearchAdapter:
schranz-search/seal-meilisearch-adapter - AlgoliaAdapter:
schranz-search/seal-algolia-adapter - SolrAdapter:
schranz-search/seal-solr-adapter - RediSearchAdapter:
schranz-search/seal-redisearch-adapter - TypesenseAdapter:
schranz-search/seal-typesense-adapter - ... more coming soon
Additional Wrapper adapters:
Creating your own adapter? Add the seal-php-adapter Topic to your Github Repository.
Usage
The following code shows how to configure the package:
<?php // config/common/params.php return [ // ... 'schranz-search/yii-module' => [ 'schemas' => [ 'app' => [ 'dir' => 'config/schemas', ], ], 'engines' => [ 'default' => [ 'adapter' => 'meilisearch://127.0.0.1:7700', ], ], 'index_name_prefix' => '', 'reindex_providers' => [ \App\Search\BlogReindexProvider::class, ], ], ];
A more complex configuration can be here found:
<?php // config/common/params.php return [ // ... 'schranz-search/yii-module' => [ 'schemas' => [ 'app' => [ 'dir' => 'config/schemas/app', 'engine' => 'meilisearch', ], 'other' => [ 'dir' => 'config/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://supersecure@127.0.0.1:6379', ], 'solr' => [ 'adapter' => 'solr://127.0.0.1:8983', ], 'typesense' => [ 'adapter' => 'typesense://S3CR3T@127.0.0.1:8108', ], // ... 'multi' => [ 'adapter' => 'multi://elasticsearch?adapters[]=opensearch', ], 'read-write' => [ 'adapter' => 'read-write://elasticsearch?write=multi', ], ], ], ];
The default engine is available as Engine:
class Some { public function __construct( private readonly \Schranz\Search\SEAL\EngineInterface $engine, ) { } }
Multiple engines can be accessed via the EngineRegistry:
class Some { private Engine $engine; public function __construct( private readonly \Schranz\Search\SEAL\EngineRegistry $engineRegistry, ) { $this->engine = $this->engineRegistry->getEngine('algolia'); } }
How to create a Schema file and use your Engine can be found SEAL Documentation.
Commands
The package provides the following commands:
Create configured indexes
./yii schranz:search:index-create
Drop configured indexes
./yii schranz:search:index-drop
Authors
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-20