Update SearchApiV2Service

This commit is contained in:
Daniel Supernault 2023-05-05 03:04:56 -06:00
parent d15bd60d87
commit 11552d1273
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -161,23 +161,8 @@ class SearchApiV2Service
protected function statusesById()
{
$mastodonMode = self::$mastodonMode;
$limit = $this->query->input('limit', 20);
$query = '%' . $this->query->input('q') . '%';
$operator = config('database.default') === 'pgsql' ? 'ilike' : 'like';
$results = Status::where('caption', $operator, $query)
->whereProfileId(request()->user()->profile_id)
->limit($limit)
->get()
->map(function($status) use($mastodonMode) {
return $mastodonMode ?
StatusService::getMastodon($status->id) :
StatusService::get($status->id);
})
->filter(function($status) {
return $status && isset($status['account']);
});
return $results;
// Removed until we provide more relevent sorting/results
return [];
}
protected function resolveQuery()