// and contain the search criteria (parameters)
// note that the default action is basic
if ($rowCount) {
+ /** @var CRM_Core_PrevNextCache_Interface $prevNext */
+ $prevNext = Civi::service('prevnext');
$cacheKey = $this->buildPrevNextCache($sort);
- $resultSet = $this->_query->getCachedContacts($cacheKey, $offset, $rowCount, $includeContactIds)->fetchGenerator();
+ $cids = $prevNext->fetch($cacheKey, $offset, $rowCount);
+ $resultSet = empty($cids) ? [] : $this->_query->getCachedContacts($cids, $includeContactIds)->fetchGenerator();
}
else {
$resultSet = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, $includeContactIds)->fetchGenerator();