Giter VIP home page Giter VIP logo

php-sphinx-search's Introduction

Sphinx for PHP 5.3 and above

Build Status Latest Stable Version Total Downloads License

This class is a port of the original Sphinx API class by Andrew Aksyonoff and Sphinx Technologies Inc to PHP 5.3 and above.

1. Requirements

  • Composer
  • PHP 5.3 or above
  • SphinxSearch

2. Added removeFilter

While all the existing methods are available and vastly documented in the Sphinx Documentation, this version of the SphinxClient for PHP includes a new method.

  • removeFilter: The original SphinxClient allows you to clear all filters. This method removes a specific filter previously set.
<?php

$sphinxSearch = new \NilPortugues\Sphinx\SphinxClient();

//Do connection and set up search method...
$sphinxSearch->setServer('127.0.0.1',9312);


// Do search...
// Result would contain "The Amazing Spider-Man 2", to be in theatres in 2014.
$sphinxSearch->setFilter('year',array(2014));
$result = $sphinxSearch->query('Spiderman','movies');

// Unset the filter to stop filtering by year
// Now we'll get all the Spiderman movies.
$sphinxSearch->removeFilter('year');
$result = $sphinxSearch->query('Spiderman','movies');

3. Added chainable methods

While updating the code, chaining capability has been added. SphinxClient's setters can be chained resulting in a cleaner code.

$sphinxSearch = new \NilPortugues\Sphinx\SphinxClient();

$result = $sphinxSearch
                ->setFilter('year',array(2014))
                ->query('Spiderman','movies')
        ;

5. Author

Nil Portugués Calderó

php-sphinx-search's People

Contributors

lenar avatar nilopc avatar nilportugues avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

php-sphinx-search's Issues

Bad Response: searchd error: bad multi-query count 0 (must be in 1..32 range)

Client Version: 1.0.3
Sphinx Version: 2.2.11-id64-release
PHP 7.0.33

Had the client implemented in our codebase for some time now and just now running into this response:

searchd error: bad multi-query count 0 (must be in 1..32 range)

It's breaking all of our search logic. We have an older legacy library that is still pulling results correctly, so I'm confident the server side is up and running correctly.

Use SplFixedArray for improved performance.

Because SplFixedArray cannot use hashes, hash defined strings need to be translated to a number representation and undo them before returning them to the final user using. Use CONSTS to map the number to the string and viceversa.

Create CONST numbers in class using this function:

$arr = array();
$str = 'attr';
for($i=0;$i<strlen($str);$i++){
    $arr[$i] = ord($str[$i]);
}
var_dump(implode('',$arr));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.