我无法使用扩展语法在Sphinx 2.2.9中搜索短语。 例如,在PHP中,我想使用听起来像这样的代码:
<?php
require ("sphinxapi.php");
$cl = new SphinxClient ();
$cl->setServer("127.0.0.1", 9312);
// $cl->SetMatchMode (SPH_MATCH_PHRASE); CAN'T USE! DEPRECATED IN VERSION 2.2.9
$MORETHANAWORD = "to be or not to be";
// some smart code...
echo "Ok, in your " . $docs . " docs the phrase " . $MORETHANAWORD . " is present " . $hits . "times.";
?>
答案 0 :(得分:0)
$res = $cl->Query("\"$MORETHANAWORD\"", 'index_name');
$docs = $res['total_found'];
无法获得$ hits。 Sphinx并没有告诉你短语发生了多少次(如果它在文档中多次出现) - 只是匹配文档的数量。