簡體   English   中英

在獅身人面像中搜索短語

[英]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。 Sphinx不會告訴您該短語出現了多少次(如果在文檔中多次出現)-只是匹配文檔的數量。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM