hightman / xunsearch

免费开源的中文搜索引擎,采用 C/C++ 编写 (基于 xapian 和 scws),提供 PHP 的开发接口和丰富文档
http://www.xunsearch.com
Other
1.64k stars 391 forks source link

getLastCount20条数据都误差在3条 #128

Open ken678 opened 2 years ago

ken678 commented 2 years ago

[root@instance-eegfzl7f php]# util/Quest.php cms --query="公司 AND modelid:3" --limit 0,5 在 20 条数据中,大约有 6 条包含 公司 AND modelid:3 ,第 1-5 条,用时:0.0022 秒。

[root@instance-eegfzl7f php]# util/Quest.php cms --query="公司 AND modelid:3" --limit 0,10 在 20 条数据中,大约有 9 条包含 公司 AND modelid:3 ,第 1-9 条,用时:0.0026 秒。

fonhen commented 2 years ago

这个问题一直到现在还存在

ken678 commented 2 years ago

几百条几千条以上有误差还过得去,几条都有这么大误差

hightman commented 2 years ago

这是 xapian 的机制所致,如果只是为了得到精确的计数,可以通过 setLimit() 并传入一个较大的 offset