Process query into server

@param   int     $offset
@param   int     $itemCountPerPage
@return  \SolrQueryResponse
@throws  ServerException
971182
protected function getResponse($offset = 0, $itemCountPerPage = 0)
    {
        $id = md5($offset . $itemCountPerPage);
        if (!isset($this->responses[$id])) {
            $query = new \SolrDisMaxQuery();
            $this->filter->filter($this->params, $query, $this->facets);
            $query->setStart($offset);
            $query->setRows($itemCountPerPage);
            try {
                $this->responses[$id] = $this->client->query($query);
            } catch (\Exception $e) {
                throw new ServerException('Failed to process query', $e->getCode(), $e);
            }
        }

        return $this->responses[$id];
    }
1321420
public function pagination(int $limit = 20, int $offset = 0, ?callable $totalQuery = null)
    {
        $query = clone $this->selectQueryInstance();

        return $query->paginate($limit, $offset, $totalQuery);
    }
720910
final public function limit($offsetOrCount, $count = null)
    {
        $this->getQuery()->limit($offsetOrCount, $count);
        $this->pagedQuery = true;

        return $this;
    }
726929
public function &getItem($offset)
    {
        $item = parent::offsetGet($offset);

        if (is_array($item)) {
            if (is_string(key($item))) {
                $item = new SplArrayObject($item);
            }
        }

        return $item;
    }
1179737
private function getManualItemsCount(Collection $collection, int $startOffset, int $endOffset): int
    {
        $manualItemsCount = 0;

        foreach ($collection->getItems() as $item) {
            $itemPosition = $item->getPosition();
            if ($itemPosition < $startOffset || $itemPosition >= $endOffset) {
                continue;
            }

            if ($this->visibilityResolver->isVisible($item) && $item->isValid()) {
                ++$manualItemsCount;
            }
        }

        return $manualItemsCount;
    }
812891
public function getItems($offset, $limit) {
		if ($this->_data === null) {
			throw new RuntimeException('Wasn\'t data been provided');
		}
		
		$items = array_slice($this->_data, $offset, $limit);
		
		if ($this->_wrapIntoCollection) {
			return new Collection($items, $this->_modelClass, $this->_primary);
		} else {
			return new ArrayIterator($items);
		}
	}
15567
public function getItems($offset, $itemCountPerPage)
    {
        if ($offset >= $this->count()) {
            return array();
        }

        $remainItemCount  = $this->count() - $offset;
        $currentItemCount = $remainItemCount > $itemCountPerPage ? $itemCountPerPage : $remainItemCount;

        return array_fill(0, $currentItemCount, null);
    }
934165
public function search(AdminInterface $admin, $term, $page = 0, $offset = 20)
    {
        $datagrid = $admin->getDatagrid();

        $found = false;
        foreach ($datagrid->getFilters() as $filter) {
            /** @var $filter FilterInterface */
            if ($filter->getOption('global_search', false)) {
                $filter->setOption('case_sensitive', $this->caseSensitive);
                $filter->setCondition(FilterInterface::CONDITION_OR);
                $datagrid->setValue($filter->getFormName(), null, $term);
                $found = true;
            }
        }

        if (!$found) {
            return false;
        }

        $datagrid->buildPager();

        $pager = $datagrid->getPager();
        $pager->setPage($page);
        $pager->setMaxPerPage($offset);
        $pager->init();

        return $pager;
    }
731819
public function paginate(Query $query, $perPage, $pageName = 'page', $fetchJoinCollection = true)
    {
        return (new PaginatorAdapter())->make(
            $query,
            $perPage,
            $pageName,
            $fetchJoinCollection
        );
    }
530302
public function offsetSet($offset, $item)
	{
		if ($offset === null)
		{
			$this->_data[] = $item;
			$this->_total = count($this->_data);
		}
		else
		{
			$this->_data[$offset] = $item;
		}
	}
847718
public function queryContext(Context\Context $reqBody, $limit = 100, $offset = 0, $details = true) {
        try {
            $urldetails = ($details) ? "on" : "off";
            $url = $this->url . "queryContext?offset=$offset&limit=$limit&details=$urldetails";
            return $this->restRequest($url, 'POST', $reqBody->get())->getResponseBody();
        } catch (Exception $e) {
            var_dump($e);
        }
    }
329946
public function getItems($offset, $itemCountPerPage)
    {
        $paginator = $this->getPaginator();
        if ($paginator instanceof Doctrine2Paginator) {
            $this->getQueryBuilder()
                ->setFirstResult($offset)
                ->setMaxResults($itemCountPerPage);

            return $paginator->getIterator()->getArrayCopy();
        } else {
            return $paginator->getItems($offset, $itemCountPerPage);
        }
    }
210073
public static function searchNode($node, $items, $offset = 0)
    {
        $len = count($items);
        for ($i = $offset; $i < $len; $i++) {
            $item = $items[$i];
            if ($item->isSameNode($node)) {
                return $i;
            }
        }
        return false;
    }
775408
public function getItems($offset, $itemCountPerPage)
    {
        $cacheKey = $offset . '-' . $itemCountPerPage;

        if (isset($this->preloadCache[$cacheKey])) {
            return $this->preloadCache[$cacheKey];
        }

        return $this->loadItems($offset, $itemCountPerPage);
    }
482202
public function listTrashed($offset, $limit, array $sort = null)
    {
        $query = $this->handler->createSelectQuery();
        $query
            ->select('*')
            ->from($this->handler->quoteTable('ezcontentobject_trash'));

        $sort = $sort ?: array();
        foreach ($sort as $condition) {
            $sortDirection = $condition->direction === Query::SORT_ASC ? SelectQuery::ASC : SelectQuery::DESC;
            switch (true) {
                case $condition instanceof SortClause\Location\Depth:
                    $query->orderBy('depth', $sortDirection);
                    break;

                case $condition instanceof SortClause\Location\Path:
                    $query->orderBy('path_string', $sortDirection);
                    break;

                case $condition instanceof SortClause\Location\Priority:
                    $query->orderBy('priority', $sortDirection);
                    break;

                default:
                    // Only handle location related sort clauses. The others
                    // require data aggregation which is not sensible here.
                    // Since also criteria are yet ignored, because they are
                    // simply not used yet in eZ Publish, we skip that for now.
                    throw new RuntimeException('Unhandled sort clause: ' . get_class($condition));
            }
        }

        if ($limit !== null) {
            $query->limit($limit, $offset);
        }

        $statement = $query->prepare();
        $statement->execute();

        $rows = array();
        while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
            $rows[] = $row;
        }

        return $rows;
    }
486366
public function updateHasIndexingPropertiesFlagByItemUid(int $itemUid, bool $hasIndexingPropertiesFlag): int
    {
        $queryBuilder = $this->getQueryBuilder();

        return $queryBuilder
            ->update($this->table)
            ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($itemUid, \PDO::PARAM_INT)))
            ->set('has_indexing_properties', $queryBuilder->createNamedParameter($hasIndexingPropertiesFlag, \PDO::PARAM_INT), false)
            ->execute();
    }
676275
public function findPaginated(
        $entityClass,
        array $criteria,
        $sorting = [],
        $offset = Request\Params::DEFAULT_PAGE_OFFSET,
        $limit = Request\Params::DEFAULT_PAGE_SIZE,
        $translatable = false
    )
    {
        $qb = $this->getQueryBuilder($entityClass, $criteria, $sorting, $translatable);
        
        $qb->setFirstResult($offset)
            ->setMaxResults($limit);

        $paginator = new Paginator($qb->getQuery());
        $collection = new PaginatedCollection($paginator);

        return $collection;
    }