在狮身人面像中搜索短语


search for a phrase in Sphinx

我无法使用扩展语法在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.";     
?>
$res = $cl->Query("'"$MORETHANAWORD'"", 'index_name');
$docs = $res['total_found'];

无法$hits。狮身人面像不会告诉你这个短语出现多少次(如果它在文档中多次出现) - 只是匹配文档的数量。