nilportugues / sphinx-search
适用于 PHP5.3 及以上版本的完全单元测试过的 SphinxClient (SphinxAPI),用于与 SphinxSearch 一起使用
1.0.3
2016-03-11 14:34 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- fabpot/php-cs-fixer: 1.*
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-09-06 08:54:00 UTC
README
此类是 Andrew Aksyonoff 和 Sphinx Technologies Inc 的原始 Sphinx API 类在 PHP 5.3 及以上版本的移植。
1. 要求
- Composer
- PHP 5.3 或更高版本
- SphinxSearch
2. 添加了 removeFilter
虽然所有现有方法都在 Sphinx 文档中有详尽的文档说明,但此版本的 SphinxClient 包含了一个新方法。
- removeFilter: 原始 SphinxClient 允许您清除所有过滤器。此方法移除之前设置的特定过滤器。
<?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. 添加了链式方法
在更新代码时,增加了链式能力。SphinxClient 的设置器可以链式使用,从而产生更简洁的代码。
$sphinxSearch = new \NilPortugues\Sphinx\SphinxClient(); $result = $sphinxSearch ->setFilter('year',array(2014)) ->query('Spiderman','movies') ;
5. 作者
Nil Portugués Calderó