tsterker/solarium-collection-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tsterker/solarium-collection-manager

Composer 安装命令:

composer require tsterker/solarium-collection-manager

包简介

Rudimentary SolrCloud collection management helper

README 文档

README

Manage Solr collections via Solarium.

Usage

Code shows a basic example on how to instantiate the CollectionManager and create a collection.

For more information:

  • See the CollectionManagerInterface for all available management methods.
  • See the integration TestCase on how you could use the CollectionManager to clear your Solr collections/aliases for test setups.

Example:

use Solarium\Client;
use Solarium\Core\Client\Adapter\Curl;
use Symfony\Component\EventDispatcher\EventDispatcher;
use TSterker\SolariumCollectionManager\CollectionManager;

// Create Solarium client (https://solarium.readthedocs.io/en/stable/client-and-adapters/)
$solariumClient = new Client(new Curl, new EventDispatcher, [
    'endpoint' => [
        'default' => ['host' => '127.0.0.1', 'port' => 8983, 'path' =>  '/']
    ],
]);

$collectionManager = new CollectionManager($client);

$collectionManager->hasCollection('foo');  // false
$collectionManager->create('foo', ['num_shards' => 2, 'nrt_replicas' => 2]);
$collectionManager->hasCollection('foo');  // true

Configuration options during collection creation:

Option Default Description
nrt_replicas 1 The number of NRT (Near-Real-Time) replicas to create for this collection.
num_shards 1 The number of shards to be created as part of the collection.
pull_replicas 0 The number of PULL replicas to create for this collection.
router_name compositeId The router name that will be used. The router defines how documents will be distributed among the shards. Possible values are implicit or compositeId.
tlog_replicas 0 The number of TLOG replicas to create for this collection.
wait_for_final_state false Whether the request should complete only when all affected replicas become active.

See the Solr documentation for details.

Development

# Fresh install
rm composer.lock && composer install

# Start multi-node Solr setup:
docker-compose up -d --wait

# Run tests
./vendor/bin/phpunit

# Lint code
./vendor/bin/phpstan analyse --memory-limit=2G

统计信息

  • 总下载量: 9.32k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固