2017 © Pedro Peláez
 

library sphinx-search-bundle

Symfony integration for SphinxSearch

image

cdwv/sphinx-search-bundle

Symfony integration for SphinxSearch

  • Friday, September 4, 2015
  • by szykra
  • Repository
  • 4 Watchers
  • 5 Stars
  • 364 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

SphinxSearchBundle

Some SphinxSearch integration with Symfony for gigablah/sphinxphp and foolz/sphinxql-query-builder. Alt text, (*1)

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

Installation

Install via composer:, (*2)

composer require cdwv/sphinx-search-bundle

QueryBuilder

You may register many connections. Example configuration is:, (*3)

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:, (*4)

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., (*5)

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

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., (*7)

Examples of usage:, (*8)

$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, (*9)

gigablah/sphinxphp

Fresh use

If you are just starting using sphinx in your project all you have to do is declare your default connection:, (*10)

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

Next decorate it with data collector:, (*11)

    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, (*12)

Now use sphinx.default like Sphinx\SphinxClient., (*13)

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

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, (*15)

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:, (*16)

    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), (*17)

    // $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)., (*18)

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., (*19)

This bundle tracks all errors that unfold during executing queries., (*20)

Authors

This bundle was originally developed by Piotr Kowalczyk, (*21)

The Versions

04/09 2015

dev-master

9999999-dev

Symfony integration for SphinxSearch

  Sources   Download

MIT

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

04/09 2015

0.1.1

0.1.1.0

Symfony integration for SphinxSearch

  Sources   Download

MIT

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

24/04 2015

0.1.0

0.1.0.0

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

24/04 2015

dev-querybuilder-ingegration

dev-querybuilder-ingegration

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

24/04 2015

0.0.6

0.0.6.0

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

24/04 2015

0.0.5

0.0.5.0

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

24/04 2015

0.0.4

0.0.4.0

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

24/04 2015

0.0.3

0.0.3.0

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

24/04 2015

0.0.2

0.0.2.0

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

24/04 2015

0.0.1

0.0.1.0

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch

01/03 2015

dev-develop

dev-develop

Symfony integration for SphinxSearch

  Sources   Download

GPL-3.0

The Requires

 

by Piotr <> Kowalczyk

search sphinx profiler sphinxsearch