# 搜索统计
# 统计数据
引擎会按索引库自动保存用户的搜索内容(分词后的词语),你可以查看某个年月日的用户搜索统计情况。
查看之前,需要一键统计数据:
// 指定索引库
$Wind = new \WindSearch\Index\Wind('test');
// 开始一键统计
$Wind->statisticsTerms();
# 查询统计结果
开始查询统计结果:
// 指定索引库
$Wind = new \WindSearch\Index\Wind('test');
// 开始获取统计数据,返回的数据格式为:
// 词语1=>频率
// 词语2=>频率
// ...
// 获取总的统计数据
$res = $Wind->getTermsStatistics('all');
// 以年为单位,获取统计数据
$res = $Wind->getTermsStatistics('y');
// 以月为单位,获取统计数据
$res = $Wind->getTermsStatistics('m');
// 以日为单位,获取统计数据
$res = $Wind->getTermsStatistics('d');