简体   繁体   English

Sphinx SPH_MATCH_ALL,SPH_MATCH_PHRASE,SPH_MATCH_BOOLEAN,SPH_MATCH_ALL和SPH_MATCH_EXTENDED2?

[英]Sphinx SPH_MATCH_ALL,SPH_MATCH_PHRASE,SPH_MATCH_BOOLEAN,SPH_MATCH_ALL and SPH_MATCH_EXTENDED2?

I am new to Sphinx Search. 我是Sphinx Search的新手。 How to use this Matching modes in PHP? 如何在PHP中使用此匹配模式?

Example: 例:

   SPH_MATCH_ALL,SPH_MATCH_PHRASE,SPH_MATCH_BOOLEAN,SPH_MATCH_ALL and SPH_MATCH_EXTENDED2?

   <?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 Bormis","abc_index");

        echo "<pre>";
        print_r($result);
        exit;
     ?>

In this code here working only SPH_MATCH_ANY. 在此代码中,仅SPH_MATCH_ANY有效。

But, I need with search exist word match.and 但是,我需要与搜索中存在单词match.and

How to use all the Matchind modes in this example? 在此示例中如何使用所有Matchind模式?

first choose you matching mode , they all work in different ways. 首先选择您的匹配模式 ,它们都以不同的方式工作。 Depending on your application, you'll make your choice. 根据您的应用程序,您将做出选择。

Sphinx uses some query operators like & (and), | Sphinx使用一些查询运算符,例如 (和), |。 (or), etc. so if you send a query like "&name Bormis" , sphinx might not understand it. (或)等,因此,如果您发送"&name Bormis"类的查询,则狮身人面像可能无法理解它。

Try using only "Bormis" as a query too see the difference between the matching modes. 尝试仅使用“ Bormis”作为查询,也可以看到匹配模式之间的差异。 If you prefer it, you could also do the search in the command line to test if your configuration is correct. 如果您愿意,也可以在命令行中进行搜索以测试您的配置是否正确。

Good Luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM