dtxzwdl08169 2012-05-09 03:29 采纳率: 0%
浏览 24
已采纳

如何使用Sphinx和CakePHP分页修复错误的结果计数?

Sphinx search displays correct results but I'm running into a problem with pagination. If my search returns 3 records, it would say "Page 1 of 1, showing 15 records out of 15 total, starting on record 1, ending on 15". Say my keyword is "How", app/views/posts/index.ctp shows 3 records with the word "How" but my pagination shows "showing 15 records out of 15 total" instead of "showing 3 records out of 3 total."

I have these lines in my code:

$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());

How should I go about fixing the pagination so it will show the correct number of items found?

  • 写回答

1条回答 默认 最新

  • douchun1961 2012-05-10 08:38
    关注

    Firstly you're not providing enough information for the community to understand where the problem resides...

    I could suggest you try AJAX based pagination (link1 , link2) and include the output of that in your sphinx output, but I do not know if you're experiencing problems connected (only) to Shpinx or Cake, or both?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?