violet88/silverstripe-elastica
Composer 安装命令:
composer require violet88/silverstripe-elastica
包简介
Module for Silverstripe to use Elastic Search
关键字:
README 文档
README
Installation
Run the following command to install the module:
composer require violet88/silverstripe-elastica
Configuration
Add the following to a file called dependencies.yml
SilverStripe\Core\Injector\Injector: Elastica\Client: constructor: - host: '`ELASTICA_HOST`' port: '`ELASTICA_PORT`' transport: '<TRANSPORT TYPE>' username: '<USERNAME>' password: '<PASSWORD>>' auth_type: '<AUTH TYPE>>' Violet88\Elastica\Tasks\ReindexTask: constructor: - '%$Violet88\Elastica\Services\ElasticaService' Violet88\Elastica\Extensions\Searchable: constructor: - '%$Violet88\Elastica\Services\ElasticaService' Violet88\Elastica\Services\ElasticaService: constructor: - '%$Elastica\Client' - '<INDEX NAME>'
And add the following to your _config.php:
if (!empty(Environment::getEnv('ELASTICASERVICE_INDEX'))) { Config::modify()->set('Injector', 'Violet88\Elastica\Services\ElasticaService', [ 'constructor' => [ '%$Elastica\Client', Environment::getEnv('ELASTICASERVICE_INDEX'), isset($env['ElasticaService']['config']) ? $env['ElasticaService']['config'] : null ] ]); // register Searchables if (!empty(Environment::getEnv('ELASTICASERVICE_SEARCHABLE'))) { foreach (unserialize(Environment::getEnv('ELASTICASERVICE_SEARCHABLE')) as $class) { $class::add_extension('Violet88\Elastica\Extensions\Searchable'); } } }
Add the following to your environment variables:
ELASTICASERVICE_INDEX='<NAME OF INDEX>' ELASTICASERVICE_SEARCHABLE='<SERIALIZED ARRAY OF SEARCHABLE CLASSES>' ELASTICA_HOST='<ELASTICSEARCH HOST' ELASTICA_PORT='<ELASTICSEARCH PORT>'
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2022-10-19