gpt4 book ai didi

php - sphinx 完美匹配问题?

转载 作者:行者123 更新时间:2023-12-04 06:28:08 26 4
gpt4 key购买 nike

我是 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com