Search for media objects.

@param Tree[]   $trees
@param string[] $search
@param int      $offset
@param int      $limit

@return Collection
@return Media[]
330436
public function searchMedia(array $trees, array $search, int $offset = 0, int $limit = PHP_INT_MAX): Collection
    {
        $query = DB::table('media');

        $this->whereTrees($query, 'media.m_file', $trees);
        $this->whereSearch($query, 'm_gedcom', $search);

        return $this->paginateQuery($query, Media::rowMapper(), GedcomRecord::accessFilter(), $offset, $limit);
    }
791159
public function limit($limit = null, $offset = null)
    {
        $this->results = $this->fetch($limit, $offset);

        return $this->results->fetchAll();
    }
248861
public function getFields($offset = 0, $limit = 100)
	{
		$fields = [];
		foreach ($this->client->get("fields?offset={$offset}&limit={$limit}") as $field) {
			$fields[] = new Resources\Field($this, $field);
		}
		return $fields;
	}
802423
public function findBy(array $criteria, array $sorting = null, $limit = null, $offset = null)
    {
        $queryBuilder = $this->getCollectionQueryBuilder();

        $this->applyCriteria($queryBuilder, $criteria);
        $this->applySorting($queryBuilder, (array) $sorting);

        if (null !== $limit) {
            $queryBuilder->setMaxResults($limit);
        }

        if (null !== $offset) {
            $queryBuilder->setFirstResult($offset);
        }

        $query = $queryBuilder->getQuery();

        if (null !== $limit) {
            return $this->collectionResult($query);
        }

        return $query->getResult();
    }
980169
public function getSuggestions(string $search): Collection
    {
        $items = $this->model::where(
            [
                ['question', 'LIKE', '%'.$search.'%'],
            ]
        )->get();

        return $items;
    }
1217853
public function all($offset = 0, $limit = 15)
    {
        $results = array_slice($this->memory, $offset, $limit);

        foreach ($results as $key => $value) {
            $results[$key] = json_decode($value[self::SUMMARY_KEY]);
        }

        return $results;
    }
804498
private function addPagination(Search $search, $pageSize, $page, $limit)
    {
        $offset = 0;
        if ($pageSize) {
            $pageSize = intval($pageSize);
            $offset = ($page - 1) * $pageSize;
        }

        if (null === $limit) {
            $limit = $this->defaultLimit;
        }

        if (null === $pageSize || $offset + $pageSize > $limit) {
            $pageSize = $limit - $offset;

            if ($pageSize < 0) {
                $pageSize = 0;
            }
        }

        $search->setFrom($offset);
        $search->setSize($pageSize);
    }
750702
public function get($itemsToGet = 0, $offset = 0)
    {
        $files = array();
        $this->createQuery();
        $r = parent::get($itemsToGet, $offset);
        foreach ($r as $row) {
            $f = ConcreteFile::getByID($row['fID']);
            $files[] = $f;
        }

        return $files;
    }
247976
public function search(string $text, int $limit = 0): array
    {
        $array = $this->split($text);
        $len = \count($array);

        $find = [];
        $position = $count = 0;
        $parent = false;
        $word = '';

        $tree = $this->tree;
        for ($i = 0; $i < $len; ++$i) {
            $char = $array[$i];

            if (isset($tree[$char])) {
                if (!$parent) {
                    $position = $i;
                    $parent = true;
                }

                $word .= $char;
                $tree = $tree[$char];

                if (isset($tree['end'])) {
                    $find[] = ['position' => $position, 'word' => $word];

                    if ($limit > 0 && ++$count === $limit) {
                        return $find;
                    }
                }
            } else {
                if ($parent) {
                    if (isset($tree['end'])) {
                        --$i;
                    } else {
                        $i = $position;
                    }
                    $parent = false;
                }

                $tree = $this->tree;
                $word = '';
            }
        }

        return $find;
    }
1358373
private function format($result, $count, $offset, $limit)
    {
        $nodes = [];
        foreach ($result as $item) {
            $resource = $this->getResource($item);
            $data = $this->getResourceData($resource);
            if ($data) {
                $nodes[] = $data;
            }
        }
        return [
            'total'  => $count,
            'offset' => $offset,
            'limit'  => $limit,
            'nodes'  => $nodes
        ];
    }
1083424
public function findAll($limit = 0, $offset = 0)
    {
        $limit = $this->getLimit($limit, $offset);
        $query = 'SELECT ' . $this->getFields(", ") . '
                  FROM ' . $this->tableName . '
                  ' . $limit . ' ;';
        $statement = $this->database->prepare($query);
        $statement->execute();
        return $this->buildAll($statement->fetchAll());
    }
144622
public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null){
        $res = array();
            
        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
            ' FROM `##maj_admintasks`';
        
        $args = array();
                
        if ($order_by) {
            $sql .= ' ORDER BY ';
            $i = 0;
            foreach ($order_by as $key => $value) {
                if ($i > 0) {
                    $sql .= ',';
                }
                
                switch ($value['dir']) {
                    case 'asc':
                        $sql .= $value['column'] . ' ASC ';
                        break;
                    case 'desc':
                        $sql .= $value['column'] . ' DESC ';
                        break;
                }
                $i++;
            }
        } else {
            $sql .= ' ORDER BY majat_name ASC';
        }
        
        if ($limit) {
            $sql .= ' LIMIT :limit OFFSET :offset';
            $args['limit']  = $limit;
            $args['offset'] = $start;
        }
            
        $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);

        foreach($data as $ga) {
            $task = $this->loadTaskFromRow($ga);
			if($task && (empty($search) || ($search && strpos($task->getTitle(), $search) !== false)))
			{
				$res[] = $task;
			}
        }
		
        return $res;
    }
443774
public function getList($search = '', $start = 0, $limit = 0, $orderBy = '', $orderByDir = 'ASC', $publishedOnly = false, $minimal = false)
    {
        $parameters = array(
            'search'        => $search,
            'start'         => $start,
            'limit'         => $limit,
            'orderBy'       => $orderBy,
            'orderByDir'    => $orderByDir,
            'publishedOnly' => $publishedOnly,
            'minimal'       => $minimal
        );

        $parameters = array_filter($parameters);

        return $this->makeRequest($this->endpoint, $parameters);
    }
901056
public function searchContentfulEntries(string $searchText, int $offset = 0, int $limit = 25, ?Client $client = null): array
    {
        $client = $client ?? $this->defaultClient;

        $query = new Query();
        $query->setLimit($limit);
        $query->setSkip($offset);
        $query->where('query', $searchText);

        return $this->buildContentfulEntries($client->getEntries($query), $client);
    }
667358
private function sitemapIndividuals(Tree $tree, int $limit, int $offset): Collection
    {
        return DB::table('individuals')
            ->where('i_file', '=', $tree->id())
            ->orderBy('i_id')
            ->skip($offset)
            ->take($limit)
            ->get()
            ->map(Individual::rowMapper());
    }
1129873
function find( array $filters = array(), $max = 20, $offset = 0 )
    {
        $index['index'] = $this->config->index;
        $index['type'] = $this->config->type;
        $index['body']['query']['bool']['must']= [
            ['match_phrase'=>[ '__meta.sid'=>$this->sid, ]]
        ];

        if (isset($filters['method'])) {
            $index['body']['query']['bool']['must'][] = [ 'match_phrase' => [ '__meta.method' => $filters['method'] ]];
        }
        if (isset($filters['uri'])) {
            $index['body']['query']['bool']['must'][] = [ 'match_phrase' => [ '__meta.uri' => $filters['uri'] ]];
        }
        if (isset($filters['ip'])) {
            $index['body']['query']['bool']['must'][] = [ 'match_phrase' => [ '__meta.ip' => $filters['ip'] ]];
        }

        $index['size'] = $max;
        $index['from'] = $offset;

        $response = $this->client->search($index);
        $result = array();
        foreach ($response['hits']['hits'] as $value) {
            if (isset($value['_source']['__meta'])) {
                $result[] = $value['_source']['__meta'];
            }
        }

        return $result;
    }
1288893
public function getItems($offset, $limit) {
		$this->select->limit($limit, $offset);
		
		return $this->datagate->fetchAll($this->select);
	}