简体   繁体   English

Sphinx-如何在PHP API中使用扩展查询语法

[英]Sphinx - how do I use the Extended query syntax with the PHP API

Can anyone explain how I would make Sphinx do phrase matching with the Extended query syntax - here is my code.. 谁能解释我将如何使用扩展查询语法使Sphinx执行短语匹配-这是我的代码。

    $cl = new SphinxClient();
    $cl->SetServer($CONF['sphinx_host'], $CONF['sphinx_port']);
    $cl->SetSortMode(SPH_MATCH_ANY);
    $cl->SetFieldWeights ( array ( "title" => 100, "description" => 90 ) );
    $cl->SetMatchMode(SPH_MATCH_EXTENDED2);
    $cl->SetRankingMode(SPH_RANK_SPH04);
    $cl->SetLimits(0, 1000);

    $q = 'She sells sea shells';
    $result = $cl->Query($q);

How would I perform phrase matching? 我将如何执行词组匹配?

 $q = '"She sells sea shells"';

只需将查询放在引号中(或只是查询的一部分!)

 $q = '"She sells" sea shells';

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

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