1. 创建索引
2. search 测试索引
PHP调用Sphinx搜索引擎
测试代码,需要为 Sphinx 创建 log 目录,启动 searchd,然后运行 PHP 应用程序
PHP 应用程序
$ sudo mkdir -p /var/log/searchd
$ sudo /usr/local/bin/searchd --config /usr/local/etc/sphinx.conf
$ php search.php
9
Array (
[fields] => Array (
[0] => partno
[1] => descrīption
)
[attrs] => Array(
[assembly] => 1
[model] => 1
)
[matches] => Array(
[9] => Array(
[weight] => 1
[attrs] => Array(
[assembly] => 5
[model] => 3
)
)
)
[total] => 1
[total_found] => 1
[time] => 0.000
[words] => Array(
[cylind] => Array(
[docs] => 2
[hits] => 2
)
)
)