承接 violet88/silverstripe-elastica 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固