sphinx / client
Sphinx API 客户端
dev-master
2016-04-05 14:48 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-09-15 19:20:47 UTC
README
有关更多信息,请参阅此 错误报告。
Sphinx PHP 客户端
从 sphinxsearch/sphinx 复制/粘贴
安装
将以下内容添加到您的 composer.json 文件的 require 部分
"sphinx/client": "dev-master"
用法
在 Sphinx 的 example_idx 索引中搜索 test 单词。
use Sphinx\Client; $sphinx = new Client(); $sphinx->setServer('localhost', 6712); $sphinx->setMatchMode(Client::MATCH_ANY); $sphinx->setMaxQueryTime(3); $result = $sphinx->query('test', 'example_idx'); var_dump($result);
打印结果
array(10) {
["error"]=>
string(0) ""
["warning"]=>
string(0) ""
["status"]=>
int(0)
["fields"]=>
array(3) {
[0]=>
string(7) "subject"
[1]=>
string(4) "body"
[2]=>
string(6) "author"
}
["attrs"]=>
array(0) {
}
["matches"]=>
array(1) {
[3]=>
array(2) {
["weight"]=>
int(1)
["attrs"]=>
array(0) {
}
}
}
["total"]=>
int(1)
["total_found"]=>
int(1)
["time"]=>
float(0)
["words"]=>
array(1) {
["to"]=>
array(2) {
["docs"]=>
int(1)
["hits"]=>
int(1)
}
}
}
许可证
此捆绑包受 GPL-3.0 许可证 的约束。请参阅文件 LICENSE 中的完整许可证。