为什么 Sphinx 中的这个查询失败了?
Why is this query in Sphinx failing?
我正在使用 sphinx 并且在大多数正常使用中查询它 returns 结果符合预期。然而,一个查询拒绝这样做。我正在使用以下查询代码:
$cl = new SphinxClient();
$cl->SetServer( "localhost", 9312 );
$cl->SetMatchMode( SPH_MATCH_EXTENDED );
$cl->SetRankingMode ( SPH_RANK_SPH04 );
$q = '"' . $cl->EscapeString($_REQUEST['keyword']) . ' @provider 2"/1';
$result = $cl->Query($q, 'mainIndex' );
查询最终变为:
"air compressor @provider 2"/1
谁能解释为什么这个查询仍然 returns 来自 ID 不同于“2”的提供商?
嗯,法定人数运算符,是 'outermost' 运算符。引号内的所有单词,将是它使用的单词。 @ 在那里没有任何特殊含义。所以查询与
相同
"air compressor provider 2"/1
因此,只需要这 4 个词中的一个。
我想知道你是否打算这样做
"air compressor"/1 @provider 2
这只会对两个单个关键字进行仲裁,然后字段语法会起作用,并且需要“2”来匹配提供者。
我正在使用 sphinx 并且在大多数正常使用中查询它 returns 结果符合预期。然而,一个查询拒绝这样做。我正在使用以下查询代码:
$cl = new SphinxClient();
$cl->SetServer( "localhost", 9312 );
$cl->SetMatchMode( SPH_MATCH_EXTENDED );
$cl->SetRankingMode ( SPH_RANK_SPH04 );
$q = '"' . $cl->EscapeString($_REQUEST['keyword']) . ' @provider 2"/1';
$result = $cl->Query($q, 'mainIndex' );
查询最终变为:
"air compressor @provider 2"/1
谁能解释为什么这个查询仍然 returns 来自 ID 不同于“2”的提供商?
嗯,法定人数运算符,是 'outermost' 运算符。引号内的所有单词,将是它使用的单词。 @ 在那里没有任何特殊含义。所以查询与
相同"air compressor provider 2"/1
因此,只需要这 4 个词中的一个。
我想知道你是否打算这样做
"air compressor"/1 @provider 2
这只会对两个单个关键字进行仲裁,然后字段语法会起作用,并且需要“2”来匹配提供者。