【发布时间】:2012-05-14 22:34:14
【问题描述】:
Sphinx 搜索显示正确的结果,但我遇到了分页问题。如果我的搜索返回 3 条记录,它将显示“第 1 页,共 1 页,显示总共 15 条记录中的 15 条记录,从记录 1 开始,到 15 结束”。假设我的关键字是“How”,app/views/posts/index.ctp 显示 3 条记录带有“How”一词,但我的分页显示“显示 15 条记录中的 15 条记录”而不是“显示 3 条记录中的 3 条记录”。
我的代码中有这些行:
$sphinx = array('matchMode' => SPH_MATCH_ALL, 'sortMode' => array(SPH_SORT_EXTENDED => '@relevance DESC'));
$results = $this->Post->find('all', array('search' => $this->data['Post']['query'], 'sphinx' => $sphinx));
$this->set('posts', $results, $this->paginate());
我应该如何修复分页以显示找到的正确数量的项目?
【问题讨论】:
标签: php cakephp cakephp-1.3 sphinx