mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update SearchApiV2Service, improve query performance
This commit is contained in:
parent
e0c3dae324
commit
4d1f281144
1 changed files with 2 additions and 2 deletions
|
@ -87,7 +87,7 @@ class SearchApiV2Service
|
|||
$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];
|
||||
|
@ -123,7 +123,7 @@ class SearchApiV2Service
|
|||
$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)
|
||||
|
|
Loading…
Reference in a new issue