mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Update SearchApiV2Service, fix hashtag search.
This commit is contained in:
parent
cd1ef7865c
commit
1992b5bc90
1 changed files with 7 additions and 3 deletions
|
@ -122,11 +122,15 @@ class SearchApiV2Service
|
|||
protected function hashtags()
|
||||
{
|
||||
$mastodonMode = self::$mastodonMode;
|
||||
$q = $this->query->input('q');
|
||||
$limit = $this->query->input('limit') ?? 20;
|
||||
$offset = $this->query->input('offset') ?? 0;
|
||||
$query = $this->query->input('q') . '%';
|
||||
return Hashtag::where('can_search', true)
|
||||
->where('name', 'like', $query)
|
||||
$query = Str::startsWith($q, '#') ? substr($q, 1) . '%' : $q . '%';
|
||||
return Hashtag::where('name', 'like', $query)
|
||||
->where(function($q) {
|
||||
return $q->where('can_search', true)
|
||||
->orWhereNull('can_search');
|
||||
})
|
||||
->offset($offset)
|
||||
->limit($limit)
|
||||
->get()
|
||||
|
|
Loading…
Reference in a new issue