SphinxClient::SetLimits PHP Method

SetLimits() public method

and optionally set max-matches and cutoff limits
public SetLimits ( $offset, $limit, $max, $cutoff )
    function SetLimits($offset, $limit, $max = 0, $cutoff = 0)
    {
        assert(is_int($offset));
        assert(is_int($limit));
        assert($offset >= 0);
        assert($limit > 0);
        assert($max >= 0);
        $this->_offset = $offset;
        $this->_limit = $limit;
        if ($max > 0) {
            $this->_maxmatches = $max;
        }
        if ($cutoff > 0) {
            $this->_cutoff = $cutoff;
        }
    }

Usage Example

Example #1
0
 /**
  * 设置limit
  * @param int $page    第几页
  * @param int $pageSize 每页多少条
  */
 public function setLimit($page, $pageSize = PAGE_SIZE)
 {
     $page = abs(intval($page));
     $pageSize = abs(intval($pageSize));
     if ($page != 0) {
         $page--;
     }
     $begin = $page * $pageSize;
     $this->_sphinx->SetLimits($begin, $pageSize);
 }
All Usage Examples Of SphinxClient::SetLimits