coreseek 的php搜索接口结果总数和匹配数不相同
程序员文章站
2022-06-01 16:13:41
...
使用coreseek做全文搜索,结果如下:
Array ( [error] => [warning] => [status] => 0 [fields] => Array ( [0] => content ) [attrs] => Array ( ) [matches] => Array ( [27] => Array ( [weight] => 1 [attrs] => Array ( ) ) [28] => Array ( [weight] => 1 [attrs] => Array ( ) ) [32] => Array ( [weight] => 1 [attrs] => Array ( ) ) [34] => Array ( [weight] => 1 [attrs] => Array ( ) ) [35] => Array ( [weight] => 1 [attrs] => Array ( ) ) [38] => Array ( [weight] => 1 [attrs] => Array ( ) ) [42] => Array ( [weight] => 1 [attrs] => Array ( ) ) [45] => Array ( [weight] => 1 [attrs] => Array ( ) ) [49] => Array ( [weight] => 1 [attrs] => Array ( ) ) [52] => Array ( [weight] => 1 [attrs] => Array ( ) ) [53] => Array ( [weight] => 1 [attrs] => Array ( ) ) [55] => Array ( [weight] => 1 [attrs] => Array ( ) ) [61] => Array ( [weight] => 1 [attrs] => Array ( ) ) [70] => Array ( [weight] => 1 [attrs] => Array ( ) ) [71] => Array ( [weight] => 1 [attrs] => Array ( ) ) [72] => Array ( [weight] => 1 [attrs] => Array ( ) ) [74] => Array ( [weight] => 1 [attrs] => Array ( ) ) [75] => Array ( [weight] => 1 [attrs] => Array ( ) ) [76] => Array ( [weight] => 1 [attrs] => Array ( ) ) [82] => Array ( [weight] => 1 [attrs] => Array ( ) ) ) [total] => 1000 [total_found] => 2931 [time] => 0.005 [words] => Array ( [我] => Array ( [docs] => 2931 [hits] => 6974 ) ) )
为什么total是1000,但是matches匹配出来的只有20条记录?
Array ( [error] => [warning] => [status] => 0 [fields] => Array ( [0] => content ) [attrs] => Array ( ) [matches] => Array ( [27] => Array ( [weight] => 1 [attrs] => Array ( ) ) [28] => Array ( [weight] => 1 [attrs] => Array ( ) ) [32] => Array ( [weight] => 1 [attrs] => Array ( ) ) [34] => Array ( [weight] => 1 [attrs] => Array ( ) ) [35] => Array ( [weight] => 1 [attrs] => Array ( ) ) [38] => Array ( [weight] => 1 [attrs] => Array ( ) ) [42] => Array ( [weight] => 1 [attrs] => Array ( ) ) [45] => Array ( [weight] => 1 [attrs] => Array ( ) ) [49] => Array ( [weight] => 1 [attrs] => Array ( ) ) [52] => Array ( [weight] => 1 [attrs] => Array ( ) ) [53] => Array ( [weight] => 1 [attrs] => Array ( ) ) [55] => Array ( [weight] => 1 [attrs] => Array ( ) ) [61] => Array ( [weight] => 1 [attrs] => Array ( ) ) [70] => Array ( [weight] => 1 [attrs] => Array ( ) ) [71] => Array ( [weight] => 1 [attrs] => Array ( ) ) [72] => Array ( [weight] => 1 [attrs] => Array ( ) ) [74] => Array ( [weight] => 1 [attrs] => Array ( ) ) [75] => Array ( [weight] => 1 [attrs] => Array ( ) ) [76] => Array ( [weight] => 1 [attrs] => Array ( ) ) [82] => Array ( [weight] => 1 [attrs] => Array ( ) ) ) [total] => 1000 [total_found] => 2931 [time] => 0.005 [words] => Array ( [我] => Array ( [docs] => 2931 [hits] => 6974 ) ) )
为什么total是1000,但是matches匹配出来的只有20条记录?
回复讨论(解决方案)
sphinxapi.php里设置_maxmatches值
客户端调用:
$cl = new SphinxClient ();
$cl->setLimits(0, 500000);
上一篇: 搜索引擎技术核心揭密_php基础
下一篇: php 去掉指定的html标签及内容