Rumah  >  Artikel  >  pembangunan bahagian belakang  >  coreseek / sphinx的几个问题

coreseek / sphinx的几个问题

WBOY
WBOYasal
2016-06-06 20:07:531145semak imbas

有这么几个问题始终弄不清楚,网上搜索很多信息,没有找到相关答案
1、php操作coreseek为什么除了安装sphinx扩展之外,还要安装libsphinxclient?如果说sphinx扩展依赖于libsphinxclient,依赖它什么?
2、扩展+libsphinxclient安装成功之后$sphinx->Query返回false,即无结果,不管是英文还是中文
而把扩展关掉,用sphinxapi.php则可以正确返回结果
如果用php操作sphinx而不是coreseek,也可以正确返回结果
3、如果用sphinxapi.php操作coreseek,中文情况下,words的下标是乱码

<code>$keyword="baixue";
$sphinx=new SphinxClient();
$sphinx->setServer("localhost",9312);
$sphinx->setMatchMode(SPH_MATCH_ANY);
$result=$sphinx->Query("$keyword","*");
echo "<pre class="brush:php;toolbar:false">";
var_dump($result);
echo "
";

环境:CentOS7、php5.4、coreseek3.2.14

回复内容:

有这么几个问题始终弄不清楚,网上搜索很多信息,没有找到相关答案
1、php操作coreseek为什么除了安装sphinx扩展之外,还要安装libsphinxclient?如果说sphinx扩展依赖于libsphinxclient,依赖它什么?
2、扩展+libsphinxclient安装成功之后$sphinx->Query返回false,即无结果,不管是英文还是中文
而把扩展关掉,用sphinxapi.php则可以正确返回结果
如果用php操作sphinx而不是coreseek,也可以正确返回结果
3、如果用sphinxapi.php操作coreseek,中文情况下,words的下标是乱码

<code>$keyword="baixue";
$sphinx=new SphinxClient();
$sphinx->setServer("localhost",9312);
$sphinx->setMatchMode(SPH_MATCH_ANY);
$result=$sphinx->Query("$keyword","*");
echo "<pre class="brush:php;toolbar:false">";
var_dump($result);
echo "
";

环境:CentOS7、php5.4、coreseek3.2.14

第一个问题:
就是依赖,也甭管为什么依赖,如果没有libsphinxclient,./configure的时候提示Cannot find libsphinxclient headers,根本无法make

第二个问题:
用$sphinx->getLastError()返回报错信息
client version is higher than daemon version (client is v.1.29, daemon is v.1.22),即客户端版本高于守护版(客户端v.1.29,守护v.1.22)
sphinx扩展版本高了,换个低版本$sphinx->Query即可返回信息

第三个问题:
charset_type = sbcs
改为
charset_type = zh_cn.utf-8
charset_dictpath = /usr/local/mmseg3/etc/(mmseg安装路径/etc/)
我把zh_cn.utf-8写成了zh.cn_utf-8,所以一直找不到问题

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn