Skip to content

Commit

Permalink
Update SearchApiV2Service, improve query performance
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Dec 31, 2022
1 parent e0c3dae commit 4d1f281
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Services/SearchApiV2Service.php
Expand Up @@ -87,7 +87,7 @@ protected function accounts($initalQuery = false)
$limit = $this->query->input('limit') ?? 20;
$offset = $this->query->input('offset') ?? 0;
$rawQuery = $initalQuery ? $initalQuery : $this->query->input('q');
$query = '%' . $rawQuery . '%';
$query = $rawQuery . '%';
if(Str::substrCount($rawQuery, '@') >= 1 && Str::contains($rawQuery, config('pixelfed.domain.app'))) {
$deliminatorCount = Str::substrCount($rawQuery, '@');
$query = explode('@', $rawQuery)[$deliminatorCount == 1 ? 0 : 1];
Expand Down Expand Up @@ -123,7 +123,7 @@ protected function hashtags()
$mastodonMode = self::$mastodonMode;
$limit = $this->query->input('limit') ?? 20;
$offset = $this->query->input('offset') ?? 0;
$query = '%' . $this->query->input('q') . '%';
$query = $this->query->input('q') . '%';
return Hashtag::where('can_search', true)
->where('name', 'like', $query)
->offset($offset)
Expand Down

0 comments on commit 4d1f281

Please sign in to comment.