开发者

sphinx perfect match problem?

开发者 https://www.devze.com 2023-02-28 17:32 出处:网络
i am new to Sphinx . <?php include(\'sphinxapi.php\'); $cl = new SphinxClient(); $cl->SetServer(\'localhost\',9312);

i am new to 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 "&开发者_运维知识库lt;pre>";
    print_r($result);
    exit;
?>

i need only "one boy" word matching records which match mode is correct for that?

i am already using SPH_MATCH_PHRASE mode. But it is not working?


  <?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; ?> 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号