mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 17:53:16 +00:00
Update SearchController, fix self search bug and rank local matches first
This commit is contained in:
parent
bc22de3545
commit
f67fada273
1 changed files with 5 additions and 2 deletions
|
@ -194,11 +194,14 @@ class SearchController extends Controller
|
||||||
|
|
||||||
else {
|
else {
|
||||||
$this->tokens['profiles'] = Cache::remember($key, $ttl, function() use($tag) {
|
$this->tokens['profiles'] = Cache::remember($key, $ttl, function() use($tag) {
|
||||||
$users = Profile::select('domain', 'username', 'name', 'id')
|
if(Str::startsWith($tag, '@')) {
|
||||||
|
$tag = substr($tag, 1);
|
||||||
|
}
|
||||||
|
$users = Profile::select('status', 'domain', 'username', 'name', 'id')
|
||||||
->whereNull('status')
|
->whereNull('status')
|
||||||
->where('id', '!=', Auth::user()->profile->id)
|
|
||||||
->where('username', 'like', '%'.$tag.'%')
|
->where('username', 'like', '%'.$tag.'%')
|
||||||
->limit(20)
|
->limit(20)
|
||||||
|
->orderBy('domain')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
if($users->count() > 0) {
|
if($users->count() > 0) {
|
||||||
|
|
Loading…
Reference in a new issue