hightman / xunsearch

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

getHotQuery总是没有数据 #13

Closed shushenghong closed 9 years ago

shushenghong commented 9 years ago

文档上说要运行一段时间,我已经运行了将近1个月了,一直有调用搜索接口。 但是getHotQuery总是返回空。

hightman commented 9 years ago

这个搜索统计会排除非干净的复杂搜索(如:包含了布尔逻辑关系、括号等),你看下是不是你调用的搜索都包含了 AND\OR 字段检索等。

此外可以用 util/Indexer.php --flush-log 刷新提交日志。

shushenghong commented 9 years ago

hi hightman,

我是这样调用搜索的:

$result = $searcher->setLimit( $pageSize, $page * $pageSize )->search( $keyword );

keyword是用户传递过来的关键词,不会太复杂。

另外我试验了下flushlog,

.../sdk/php/util$ ./Quest.php --hot=last --limit=5 topic

暂无相关热门搜索记录。

.../sdk/php/util$ ./Indexer.php --flush-log --project topic

刷新搜索日志 ...

成功,注意:后台更新需要一些时间,并不是真正立即完成。

.../sdk/php/util$ ./Quest.php --hot=last --limit=5 topic

暂无相关热门搜索记录。

谢啦。

在 2015年1月26日 上午10:16,hightman notifications@github.com写道:

这个搜索统计会排除非干净的复杂搜索(如:包含了布尔逻辑关系、括号等),你看下是不是你调用的搜索都包含了 AND\OR 字段检索等。

此外可以用 util/Indexer.php --flush-log 刷新提交日志。

— Reply to this email directly or view it on GitHub https://github.com/hightman/xunsearch/issues/13#issuecomment-71407030.

shushenghong commented 9 years ago

hi hightman,现在搜索数据来了,估计是flush的效果,但数据看上去不太对,现在只有一个王菲,但我明明搜了很多其他的呢。

.../sdk/php/util$ ./Quest.php --hot=total --limit=5 topic

序 搜索关键词(total) 次数

  1. 王菲 1

.../sdk/php/util$ ./Quest.php --hot=lastnum --limit=5 topic

序 搜索关键词(total) 次数

  1. 王菲 1

.../sdk/php/util$ ./Quest.php --hot=currnum --limit=5 topic

序 搜索关键词(total) 次数

  1. 王菲 1
shushenghong commented 9 years ago

hi hightman,我看了xunsearch的php源码发现问题所在了,貌似只有setQuery再search的才会写log 我原先搜索使用的 $searcher->search( $kw ) 现在改用 $searcher->setQuery( $kw )->search() 就好啦,谢谢