我是 Sphinx 新手。
<?php
include('sphinxapi.php');
$cl = new SphinxClient();
$cl->SetServer('localhost',9312);
//$cl->SetMatchMode(SPH_MATCH_ANY);
//$cl->SetMatchMode(SPH_MATCH_EXTENDED2);
//$cl->SetMatchMode(SPH_MATCH_ALL);
$cl->SetMatchMode(SPH_MATCH_PHRASE);
$cl->SetArrayResult(true);
$cl->SetLimits(0, 100);
$result = $cl->Query("&name one boy","abc_index");
echo "<pre>";
print_r($result);
exit;
?>
我只需要“one boy
”单词匹配记录,哪种匹配模式适合该记录?
我已经在使用 SPH_MATCH_PHRASE
模式。但它不起作用?
最佳答案
<?php
include('sphinxapi.php');
$cl = new SphinxClient();
$cl->SetServer('localhost',9312);
$cl->SetMatchMode(SPH_MATCH_EXTENDED2);
$cl->SetArrayResult(true);
$cl->SetLimits(0, 100);
//this is for perfect match mode
$searchkey='one boy';
$sphinxQry = '@(name) '. '"'.$searchkey.'"';
$result = $cl->Query($sphinxQry,"abc_index");
echo "<pre>";
print_r($result);
exit; ?>
关于php - sphinx完美匹配问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5775251/