2017 © Pedro Peláez
 

library sphinx-search

A set of classes wrapping the SphinxClient extension in a object-oriented way.

image

scorpio/sphinx-search

A set of classes wrapping the SphinxClient extension in a object-oriented way.

  • Wednesday, February 7, 2018
  • by dredfern
  • Repository
  • 1 Watchers
  • 0 Stars
  • 91 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 3 % Grown

The README.md

Scorpio SphinxSearch

The Sphinx extension is deprecated and officially unsupported. This package has been updated, but is now deprecated. Please see: https://github.com/FoolCode/SphinxQL-Query-Builder for an alternative. This package should still function provided an instance implementing the SphinxClient is used e.g.: https://github.com/nilportugues/php-sphinx-search., (*1)

SphinxSearch library is a wrapper around the PHP Sphinx extension that allows for a cleaner object oriented interface., (*2)

Most aspects of the API are covered., (*3)

Requirements

  • PHP 5.5+
  • PHP Sphinx extension
  • Codeception 2.1+ for unit tests
  • Sphinx Server

Note: while the Sphinx extension is required for composer, provided the client class has a SphinxClient like interface, it can be substituted in the ServerSettings; however installation must be done manually., (*4)

Installation

Install using composer, or checkout / pull the files from github.com., (*5)

  • composer install scorpio/sphinx-search

A stub file is included in Resources for IDE completion / constant reference., (*6)

Using

You need a Sphinx server instance running. A sample config file is located in Resources/docs., (*7)

OSX:, (*8)

  • brew install sphinx php56-sphinx
  • configure sphinx instance

CentOS:, (*9)

  • setup IUS repository for your version of CentOS
  • yum install php56-sphinx sphinx
  • configure sphinx server and data

Note: the last available extension version is for PHP56 (1.3.3)., (*10)

Setup code:, (*11)

require_once 'path/to/vendor/autoload.php';

use Scorpio\SphinxSearch\SearchManager;

$manager = new SearchManager(new ServerSettings('localhost', 9312));

To search via Sphinx, you need to create Index definitions. Each index must be created in the Sphinx config file first. A specific instance for each index must then be created that sets the available fields, attributes (filters) etc that this index exposes. Once that is done, the index is passed to the query., (*12)

The SearchManager allows multiple queries to be run at once., (*13)

Note: once a query has been bound to SphinxClient it cannot be removed. To run separate queries on the same Sphinx client you must create a new client instance. The SearchManager will automatically destroy the SphinxClient after a search run., (*14)

Note: when setting max query time, this value is in milliseconds. If set below e.g.: 100 ms you may return only a small, inconsistent set of results. Ensure that the time you use is enough to cover your searching e.g.: 5000 ms is usually enough. 0 (zero) will set no limit., (*15)

Running Unit Tests

Codeception is used as the test framework:, (*16)

  • curl -s http://getcomposer.org/installer | php
  • git clone git@github.com:scorpioframework/sphinx-search.git
  • php composer.phar install
  • bin/codecept run unit

To run code-coverage, you will need to temporarily disable the Sphinx extension as it causes a seg-fault in ServerSettings to do with the extension check and SphinxClient class. At the time of writing a solution had not been found., (*17)

  • http://sphinxsearch.com/docs/latest/index.html
  • http://ca.php.net/sphinx
  • https://github.com/gigablah/sphinxphp

A more modern SQL like Sphinx-QL exists, see the following for more details:, (*18)

  • https://github.com/FoolCode/SphinxQL-Query-Builder

The Versions

07/02 2018

dev-master

9999999-dev

A set of classes wrapping the SphinxClient extension in a object-oriented way.

  Sources   Download

BSD BSD-3-Clause

The Requires

  • php >=5.6

 

The Development Requires

sphinx sphinx search scorpio

02/09 2017

0.3.0

0.3.0.0

A set of classes wrapping the SphinxClient extension in a object-oriented way.

  Sources   Download

BSD

The Requires

  • php >=5.6

 

The Development Requires

sphinx sphinx search scorpio

28/09 2015

0.2.1

0.2.1.0

A set of classes wrapping the SphinxClient extension in a object-oriented way.

  Sources   Download

BSD

The Requires

  • php >=5.5.0

 

The Development Requires

sphinx sphinx search scorpio

28/09 2015

dev-develop

dev-develop

A set of classes wrapping the SphinxClient extension in a object-oriented way.

  Sources   Download

BSD

The Requires

  • php >=5.5.0

 

The Development Requires

sphinx sphinx search scorpio

27/09 2015

0.2.0

0.2.0.0

A set of classes wrapping the SphinxClient extension in a object-oriented way.

  Sources   Download

BSD

The Requires

  • php >=5.5.0
  • ext-sphinx *

 

The Development Requires

sphinx sphinx search scorpio

26/09 2015

0.1.0

0.1.0.0

A set of classes wrapping the SphinxClient extension in a object-oriented way.

  Sources   Download

BSD

The Requires

  • php >=5.5.0
  • ext-sphinx *

 

The Development Requires

sphinx sphinx search scorpio