dev-master
9999999-devSphinx Client 支持 Swoole 协程环境
GPL-2.0
The Requires
- php >=7.0
- ext-swoole >=4.0.3
The Development Requires
v1.0.0
1.0.0.0Sphinx Client 支持 Swoole 协程环境
GPL-2.0
The Requires
- php >=7.0
- ext-swoole >=4.0.3
The Development Requires
Wallogit.com
2017 © Pedro Peláez
Sphinx Client 支持 Swoole 协程环境
这是一个适合用于 Swoole 协程环境下的 SphinxClient,支持内置连接池。, (*2)
代码基于 Sphinx 官方自带的 SphinxClient 修改,完全遵守原项目的 GPL-2.0 协议。, (*3)
Composer:"yurunsoft/sphinx-client-swoole":"~1.0", (*4)
使用方式和 Sphinx 官方自带的 SphinxClient 并无两样,唯一需要注意的是只支持在 Swoole 协程下运行。, (*5)
// 初始化连接池,改为你自己的连接配置
SphinxPool::init(5, '192.168.0.110', 9312);
// 连接池使用
SphinxPool::use(function($sphinxClient){
// 改成你自己的搜索名和索引名
$result = $sphinxClient->Query('query string', 'indexName');
if($result)
{
var_dump($result['total']);
}
else
{
var_dump($sphinxClient->GetLastError());
}
});
$client = new SphinxClient;
// 改为你自己的连接配置
$client->SetServer('192.168.0.110', 9312);
// 改成你自己的搜索名和索引名
var_dump($client->Query('query string', 'indexName'));
更加详细的示例代码请看test目录下代码。, (*6)
Sphinx Client 支持 Swoole 协程环境
GPL-2.0
Sphinx Client 支持 Swoole 协程环境
GPL-2.0