public function getHotQuery($limit = 6, $type = 'total')
{
$ret = array();
$limit = max(1, min(50, intval($limit)));
$this->xs->setScheme(XSFieldScheme::logger());
try {
$this->setDb(self::LOG_DB)->setLimit($limit);
if ($type !== 'lastnum' && $type !== 'currnum') {
$type = 'total';
}
// 加上下面这一句就OK了
$this->setSort('total');
$result = $this->search($type . ':1');
foreach ($result as $doc) /* @var $doc XSDocument */ {
$body = $doc->body;
$ret[$body] = $doc->f($type);
}
$this->restoreDb();
} catch (XSException $e) {
if ($e->getCode() != XS_CMD_ERR_XAPIAN) {
throw $e;
}
}
$this->xs->restoreScheme();
return $ret;
}
$this->setSort('total');

不正确的

{
"errno": 0,
"errdesc": "操作成功",
"timestamp": 1576057980,
"data": {
"项目测试": "2",
"俗话说": "1",
"测试": "12",
"项目": "1"
}
}

正确的

{
"errno": 0,
"errdesc": "操作成功",
"timestamp": 1576057928,
"data": {
"测试": "12",
"项目测试": "2",
"俗话说": "1",
"项目": "1"
}
}

最新文章

  1. [转]Python yield 使用浅析
  2. webbrowser 禁用 alert
  3. Mac中体验ASP.NET 5 beta2的K gen代码生成
  4. 获取ItemsControl中当前item的binding数据
  5. dubbo通信协议之对比
  6. no.1
  7. Fusioncharts使用说明
  8. 掌握iOS自动布局
  9. Transaction的理解
  10. CF 295E Yaroslav and Points(Splay)
  11. collapse
  12. .net 常用方法
  13. POJ 3691 & HDU 2457 DNA repair (AC自己主动机,DP)
  14. iOS 打包上传AppStore相关(2)-Xcode相应配置
  15. Chapter 2 Open Book——6
  16. 为什么阿里巴巴禁止在 foreach 循环里进行元素的 remove/add 操作--java.util.ConcurrentModificationException
  17. python3 cookie
  18. [转帖] cnblog新闻区 “40岁以上的员工,请自觉离开”
  19. Linux下的定时器类实现(select定时+线程)
  20. js模块化的两种规范AMD和CMD

热门文章

  1. MySql数据库中正则表达式
  2. 设计模式之(十)装饰模式(DECORATOR)
  3. [git] your branch is ahead of ... 解决办法
  4. Telegram Android源码问题汇总 持续更新
  5. Python环境安装与基础语法(4)——内存管理、if分支
  6. 非root用户安装、配置mysql
  7. 青春正盛,未来可期。马上2020了,低成本投资自己:vip测试提升圈
  8. Lp距离, L1范数, 和L2范数(转载)
  9. Mysql基础知识--视图
  10. LeetCode3-Longest_Substring_Without_Repeating_Characters