php启用sphinx全文搜索的方法
[0] => name
[1] => type
)
[attrs] => Array
(
[stock] => 1
)
[matches] => Array
(
[0] => Array
(
[id] => 8
[weight] => 1
[attrs] => Array
(
[stock] => 100
)
)
)
[total] => 1
[total_found] => 1
[time] => 0.018
[words] => Array
(
[名卡] => Array
(
[docs] => 1
[hits] => 1
)
)
)
Array
(
[error] =>
[warning] =>
[status] => 0
[fields] => Array
(
[0] => name
[1] => type
)
[attrs] => Array
(
[stock] => 1
)
[matches] => Array
(
[0] => Array
(
[id] => 8
[weight] => 1
[attrs] => Array
(
[stock] => 100
)
)
)
[total] => 1
[total_found] => 1
[time] => 0.018
[words] => Array
(
[名卡] => Array
(
[docs] => 1
[hits] => 1
)
)
)
完全没问题,搜索出来了,几个关键的操作:
[root@beihai365 /]# csft-searchd --stop 停止搜索守护
[root@beihai365 /]# csft-indexer --all 针对所有节点生成索引,你也可以针对某个节点生成索引比如:csft-indexer xx
[root@beihai365 /]# csft-search App 搜索关键字 App,不过看下面信息没有搜到和没有命中任何的文档.
Coreseek Full Text Server 3.1
Copyright (c) 2006-2008 coreseek.com
using config file './csft.conf'...
1,
pt:1, 1; index 'tmsgsindex': query 'App ': returned 0 matches of 0 total in 0.017 sec
words:
1. 'app': 0 documents, 0 hits
当大家在运行这些命令的时候发现,需要你自己手动的置顶 --config sphinx.conf 配置文件的路径,很不方便,所以我干脆 ln -s 一个在 ./,这样不用每次都去敲入 --config.
希望本文所述对大家的php程序设计有所帮助。
【php启用sphinx全文搜索的方法】相关文章: