1
我使用的是狮身人面像,除了SetLimits之外,一切看起来都很好,我在索引中只有3条记录,当我使用$ cl-> SetLimits(0,2)时它返回2结果。 当我使用$ cl-> SetLimits(1,2)时,我也得到了2,当我使用$ cl-> SetLimits(1,2)时,我什么都没有。sphinx setlimits不起作用
这是我的setlimits
$cl->SetLimits(0,2);// should return the first two matches
$cl->SetLimits(1,2);// should return only one as I have only 3 records in the index
$cl->SetLimits(2,2);// should return nothing
的理解这是我插在DB
insert into tindex values('1','test');
insert into tindex values('2','test');
insert into tindex values('3','test');
,我可以看到它时,我选择索引。
PHP代码低于
$keywords = "test";
$index = "tindex";
$cl = new SphinxClient();
$cl->SetServer("127.0.0.1", 9312);
$cl->SetMatchMode(SPH_MATCH_ANY );
$cl->SetLimits(1,2);
$result = $cl->Query($keywords, $index );
if ($result === false) {
echo "Query failed: " . $cl->GetLastError() . ".\n";
}
else {
if ($cl->GetLastWarning()) {
echo "WARNING: " . $cl->GetLastWarning() . "";
}
if (! empty($result["matches"])) {
foreach ($result["matches"] as $doc => $docinfo) {
}
print_r($result);
}
}
审阅中发现的问题,我有第一个问题,它是抵消,而不是页码:) – user2628572