mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-03-20 18:27:11 +01:00
Fix search
This commit is contained in:
parent
6b2ae80414
commit
106dfc14b6
1 changed files with 9 additions and 4 deletions
|
@ -27,6 +27,7 @@ use App\Models\User;
|
||||||
use Elasticsearch\Client;
|
use Elasticsearch\Client;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class Search
|
class Search
|
||||||
|
@ -61,6 +62,7 @@ class Search
|
||||||
'query' => [
|
'query' => [
|
||||||
'multi_match' => [
|
'multi_match' => [
|
||||||
'query' => $query,
|
'query' => $query,
|
||||||
|
'type' => 'phrase_prefix',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'title^3',
|
'title^3',
|
||||||
'artist^2',
|
'artist^2',
|
||||||
|
@ -80,6 +82,7 @@ class Search
|
||||||
'query' => [
|
'query' => [
|
||||||
'multi_match' => [
|
'multi_match' => [
|
||||||
'query' => $query,
|
'query' => $query,
|
||||||
|
'type' => 'phrase_prefix',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'title^2',
|
'title^2',
|
||||||
'artist',
|
'artist',
|
||||||
|
@ -97,6 +100,7 @@ class Search
|
||||||
'query' => [
|
'query' => [
|
||||||
'multi_match' => [
|
'multi_match' => [
|
||||||
'query' => $query,
|
'query' => $query,
|
||||||
|
'type' => 'phrase_prefix',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'title^3',
|
'title^3',
|
||||||
'curator',
|
'curator',
|
||||||
|
@ -114,6 +118,7 @@ class Search
|
||||||
'query' => [
|
'query' => [
|
||||||
'multi_match' => [
|
'multi_match' => [
|
||||||
'query' => $query,
|
'query' => $query,
|
||||||
|
'type' => 'phrase_prefix',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'display_name',
|
'display_name',
|
||||||
'tracks',
|
'tracks',
|
||||||
|
@ -126,10 +131,10 @@ class Search
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tracks = $this->transformTracks($results['responses'][0]['hits']['hits']);
|
$tracks = $this->transformTracks(Arr::get($results, 'responses.0.hits.hits', []));
|
||||||
$albums = $this->transformAlbums($results['responses'][1]['hits']['hits']);
|
$albums = $this->transformAlbums(Arr::get($results, 'responses.1.hits.hits', []));
|
||||||
$playlists = $this->transformPlaylist($results['responses'][2]['hits']['hits']);
|
$playlists = $this->transformPlaylist(Arr::get($results, 'responses.2.hits.hits', []));
|
||||||
$users = $this->transformUsers($results['responses'][3]['hits']['hits']);
|
$users = $this->transformUsers(Arr::get($results, 'responses.3.hits.hits', []));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'tracks' => $tracks,
|
'tracks' => $tracks,
|
||||||
|
|
Loading…
Add table
Reference in a new issue