btmoda/solarium-bundle
Composer 安装命令:
composer require btmoda/solarium-bundle
包简介
Integration with solarium solr client.
README 文档
README
About
The NelmioSolariumBundle provides integration with the solarium solr client.
Installation
Require the nelmio/solarium-bundle package in your composer.json and update your dependencies.
$ composer require nelmio/solarium-bundle
Add the NelmioSolariumBundle to your AppKernel.php
public function registerBundles() { $bundles = array( ... new Nelmio\SolariumBundle\NelmioSolariumBundle(), ... ); ... }
Basic configuration
Quick-start configuration:
nelmio_solarium: ~
Gives you a Solarium_Client service with default options (http://localhost:8983/solr)
$client = $this->get('solarium.client');
Configure your endpoints in config.yml:
nelmio_solarium: endpoints: default: scheme: http host: localhost port: 8983 path: /solr core: active timeout: 5 clients: default: endpoints: [default]
If you only have one endpoint, the client section is not necessary
Usage
$client = $this->get('solarium.client'); $select = $client->createSelect(); $select->setQuery('foo'); $results = $client->select($select);
For more information see the Solarium documentation.
Multiple clients and endpoints
nelmio_solarium: endpoints: default: host: 192.168.1.2 another: host: 192.168.1.3 clients: default: endpoints: [default] another: endpoints: [another]
$defaultClient = $this->get('solarium.client'); $anotherClient = $this->get('solarium.client.another');
You may also change default name with your own, but don't forget change default_client option if you want to get access to
solarium.client service
nelmio_solarium: default_client: firstOne endpoints: firstOne: host: 192.168.1.2 anotherOne: host: 192.168.1.3 clients: firstOne: endpoints: [firstOne] anotherOne: endpoints: [anotherOne]
$firstOneClient = $this->get('solarium.client'); //or $firstOneClient = $this->get('solarium.client.firstOne'); $anotherOneClient = $this->get('solarium.client.anotherOne');
Starting from Solarium 3.x you can also have multiple endpoints within the same client
nelmio_solarium: endpoints: default: host: 192.168.1.2 another: host: 192.168.1.3 # if you are using all the endpoints, the clients section is not necessary clients: default: endpoints: [default, another]
You can also set wich is the default endpoint
nelmio_solarium: endpoints: default: host: 192.168.1.2 another: host: 192.168.1.3 clients: default: endpoints: [default, another] default_endpoint: another
You can combine both multiple client and endpoints too
nelmio_solarium: endpoints: one: host: 192.168.1.2 two: host: 192.168.1.3 three: host: 192.168.1.4 clients: firstOne: endpoints: [one, two] default_endpoint: two secondOne: endpoints: [two, three] default_endpoint: three
Client registry
You can also use the service solarium.client_registry to access the clients you have configured using the names you have used in the configuration (with the example above):
$registry = $this->get('solarium.client_registry'); $firstOne = $registry->getClient('firstOne'); $secondOne = $registry->getClient('secondOne');
or if you have configured a default client
$registry = $this->get('solarium.client_registry'); $default = $registry->getClient();
Plugins
Solarium works with plugins. If you want to use your own plugins, you can register a plugin in the bundle configuration either with a service id or the plugin class:
nelmio_solarium: clients: default: plugins: test_plugin_service: plugin_service: plugin _service_id test_plugin_classname: plugin_class: Some\Plugin\TestPlugin
Overriding Classes
To change the adapter or client classes, you can set the client_class and adapter_class options:
nelmio_solarium: clients: default: client_class: Solarium\Core\Client adapter_class: Solarium\Core\Client\Adapter\Http
License
Released under the MIT License, see LICENSE.
btmoda/solarium-bundle 适用场景与选型建议
btmoda/solarium-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.3k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「solr」 「search」 「solarium」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 btmoda/solarium-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 btmoda/solarium-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 btmoda/solarium-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A bundle which extend ibexa solr search handler
A Laravel package to retrieve data from Google Search Console
This extension provides integration with solr to output content from TYPO3 in JSON format.
Laminas Module for interaction between a laminas application and a SOLR search engine using Solarium
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
An Apache Solr driver for laravel scout
统计信息
- 总下载量: 1.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-26