Limit search results to 25 for now

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/295/head
Julius Härtl 2019-02-01 17:11:00 +01:00 zatwierdzone przez Maxence Lange
rodzic 20b8e0a51a
commit 25dd9afe85
3 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -250,6 +250,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
$this->searchInAccount($qb, $search);
$this->leftJoinCacheDocuments($qb, 'icon_id');
$this->leftJoinDetails($qb);
$this->limitResults($qb, 25);
$accounts = [];
$cursor = $qb->execute();

Wyświetl plik

@ -190,6 +190,16 @@ class CoreRequestBuilder {
$this->limitToDBField($qb, 'token', $token);
}
/**
* Limit the results to a given number
*
* @param IQueryBuilder $qb
* @param int $limit
*/
protected function limitResults(IQueryBuilder $qb, int $limit) {
$qb->setMaxResults($limit);
}
/**
* Limit the request to the ActorId

Wyświetl plik

@ -128,6 +128,7 @@ class HashtagsRequest extends HashtagsRequestBuilder {
public function searchHashtags(string $hashtag): array {
$qb = $this->getHashtagsSelectSql();
$this->searchInHashtag($qb, $hashtag);
$this->limitResults($qb, 25);
$hashtags = [];
$cursor = $qb->execute();