2017 © Pedro Peláez
 

library sphinxsearch

Search any sphinx index

image

bboer/sphinxsearch

Search any sphinx index

  • Thursday, October 10, 2013
  • by bboer
  • Repository
  • 0 Watchers
  • 2 Stars
  • 81 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SphinxSearch 1.0

By [Bart de Boer] (http://github.com/bboer/), (*1)

Introduction

When you like to search sphinx generated indexes from a zf2 application, use this module., (*2)

Installation

  1. Preparation, (*3)

    Make sure you have a working Sphinx server anywhere, (*4)

  2. Require SphinxSearch, (*5)

    From within your project execute the following:, (*6)

    php composer.phar require bboer/sphinxsearch
    
  3. Configure SphinxSearch, (*7)

    copy sphinxsearch.local.php.dist to your /config/autoload/sphinxsearch.local.php, (*8)

    Sample configuration:, (*9)

    <?php
    return array(
        'sphinx_search' => array(
            'server' => array(
                'host' => 'mysphinxhost.com',
                'port' => 9312,
            ),
        ),
    );
    
    

Usage

  1. Using the Search service using the ServiceTrait, (*10)

    <?php
    namespace MyModule\MySpace;
    
    use Zend\ServiceManager\ServiceLocatorAwareInterface;
    
    class MyService implements ServiceLocatorAwareInterface
    {
        use \SphinxSearch\ServiceManager\ServiceTrait;
    
        public function myServiceMethod()
        {
            // Get the results from the SphinxSearch service
            $results = $this->getSphinxSearchService()->search(
                'person_main',
                $filters,
                $queries,
                $fieldWeights,
                $limit,
                $offset
            );
            // NOTE: Used variables are not defined and intended as an example
        }
    }
    
  2. Using the Search service by locating it through the ServiceLocator, (*11)

    <?php
    namespace MyModule\MySpace;
    
    use Zend\ServiceManager\ServiceLocatorAwareInterface;
    
    class MyService implements ServiceLocatorAwareInterface
    {
        use \SphinxSearch\ServiceManager\ServiceTrait;
    
        public function myServiceMethod()
        {
            // Get the SphinxSearch Search service
            $searchService = $this->getServiceLocator()->get(
                'SphinxSearch\Search\Search'
            );
            // Get the results from the SphinxSearch service
            $results = $searchService->search(
                'person_main',
                $filters,
                $queries,
                $fieldWeights,
                $limit,
                $offset
            );
            // NOTE: Used variables are not defined and intended as an example
        }
    }
    

The Versions

10/10 2013

dev-master

9999999-dev

Search any sphinx index

  Sources   Download

The Requires

 

by Bart de Boer

search sphinx index