承接 cdwv/sphinx-search-bundle 相关项目开发

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

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

cdwv/sphinx-search-bundle

Composer 安装命令:

composer require cdwv/sphinx-search-bundle

包简介

Symfony integration for SphinxSearch

README 文档

README

Some SphinxSearch integration with Symfony for gigablah/sphinxphp and foolz/sphinxql-query-builder. Alt text

Version 0.1.* was released during Codewave's shipit day!

Installation

Install via composer:

composer require cdwv/sphinx-search-bundle

QueryBuilder

You may register many connections. Example configuration is:

ekiwok_sphinx:
    connections:
        default:
            host: localhost
            port: 9306
            driver: pdo
        remote:
            host: remote-host
            port: 9306
            driver: mysqli

Default connection with following configuration will always be created unless you provide alternative default configuration:

host: localhost
port: 9306
driver: pdo

It means if you want to use pdo and you are running sphinx daemon on localhost on port 9306 you do not have to provide any configuration.

Please notice that $this->get('sphinx')->getConnection() is equivalent to $this->get('sphinx')->getConnection('default').

Connections returned by sphinx service implements Ekiwok\SphinxBundle\Sphinx\QL\ConnectionInterface that extends Foolz\SphinxQL\Drivers\ConnectionInterface by createQueryBuilder() method so thay may be (and shoud be) used interchangeable with Foolz\SphinxQL connections.

Examples of usage:

$sphinx = $this->get('sphinx');
$conn = $sphinx->getConnection();
$recipes = $conn->createQueryBuilder()
                ->select('id', 'title')
                ->from('recipes')
                ->match('title', 'chicken')
                ->limit(100)
                ->execute();
$sphinx = $this->get('sphinx');
$conn = $sphinx->getConnection();
$recipes = $conn->query('SELECT id, title FROM recipes WHERE MATCH("(@title chicken)")');

For more please visit https://github.com/FoolCode/SphinxQL-Query-Builder

gigablah/sphinxphp

Fresh use

If you are just starting using sphinx in your project all you have to do is declare your default connection:

    sphinx.default.connection:
        class: Sphinx\SphinxClient
        calls: 
            - [setServer, ['127.0.0.1', 9312] ]

Next decorate it with data collector:

    sphinx.default:
        class: Ekiwok\SphinxBundle\Sphinx\SphinxDataCollector
        arguments: [@sphinx.default.connection, @sphinx_stats]

@sphinx_stats is service that provides data to profiler. You may implement your own provider by implementing: Ekiwok\SphinxBundle\Sphinx\SphinxDataCollector

Now use sphinx.default like Sphinx\SphinxClient.

$sphinxClient = $this->get('sphinx.default');

Replacing Sphinx\SphinxClient

Symfony 2.5+

If you are using Symfony 2.5+ you may be interested in service decoration: http://symfony.com/doc/current/components/dependency_injection/advanced.html#decorating-services

Replacing Sphinx\SphinxClient

If you have your SphinxClient registered for example as sphinx.default use little hack, change this service name to sphinx.default.connection and register SphinxDataCollector as sphinx.default. Because SphinxDataCollector extends SphinxClient it shoud have no side effects on your project:

    sphinx.default:
        class: Ekiwok\SphinxBundle\Sphinx\SphinxDataCollector
        arguments: [@sphinx.default.connection, @sphinx_stats]

You can always instantiate SphinxDataCollector manually (for example in situation when you don't have your SphinxClient managed by container)

    // $sphinxClient is instance of Sphinx\SphinxClient
    $sphinxStats = $this->get('sphinx_stats');
    $sphinxClient = new \Ekiwok\SphinxBundle\Sphinx\SphinxDataCollector($sphinxClient, $sphinxStats);

What does this bundle do?

Well, it shows fancy things and stuff in profiler and toolbar. Those things are now query calls and errors. So all it does is tracking calls of SphinxClient query method and measuring time of this method execution (yeah, it's not actuall query time).

Because SphinxClient uses binary protocol this bundle does not show real human readable queries that may be copied to sphinx cli. (Now =) Unfortunately, it shows just arguments (query, indexes and comment) passed to query method.

This bundle tracks all errors that unfold during executing queries.

Authors

This bundle was originally developed by Piotr Kowalczyk

cdwv/sphinx-search-bundle 适用场景与选型建议

cdwv/sphinx-search-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 374 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 05 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「search」 「profiler」 「sphinx」 「sphinxsearch」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 cdwv/sphinx-search-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cdwv/sphinx-search-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 cdwv/sphinx-search-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 374
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-21