mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 06:27:59 +01:00
#1: Progress commit - some semblance of this is working now.
This commit is contained in:
parent
e0faefee23
commit
990916171c
7 changed files with 315 additions and 154 deletions
|
@ -23,34 +23,16 @@ namespace Poniverse\Ponyfm\Http\Controllers\Api\Web;
|
|||
use Elasticsearch;
|
||||
use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase;
|
||||
use Input;
|
||||
use Poniverse\Ponyfm\Library\Search;
|
||||
use Response;
|
||||
|
||||
class SearchController extends ApiControllerBase
|
||||
{
|
||||
public function getSearch()
|
||||
public function getSearch(Search $search)
|
||||
{
|
||||
$input = Input::all();
|
||||
|
||||
$elasticsearch = Elasticsearch::connection();
|
||||
|
||||
$results = $elasticsearch->search([
|
||||
'index' => 'ponyfm',
|
||||
'type' => 'track,album',
|
||||
'body' => [
|
||||
'query' => [
|
||||
'multi_match' => [
|
||||
'query' => $input['query'],
|
||||
'fields' => [
|
||||
'track.title',
|
||||
'album.title',
|
||||
'track.artist',
|
||||
'album.artist',
|
||||
'track.genre',
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
$results = $search->searchAllContent($input['query']);
|
||||
|
||||
return Response::json([
|
||||
'results' => $results,
|
||||
|
|
160
app/Library/Search.php
Normal file
160
app/Library/Search.php
Normal file
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Pony.fm - A community for pony fan music.
|
||||
* Copyright (C) 2016 Peter Deltchev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Poniverse\Ponyfm\Library;
|
||||
|
||||
use DB;
|
||||
use Elasticsearch\Client;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Poniverse\Ponyfm\Models\Album;
|
||||
use Poniverse\Ponyfm\Models\Playlist;
|
||||
use Poniverse\Ponyfm\Models\Track;
|
||||
use Poniverse\Ponyfm\Models\User;
|
||||
|
||||
class Search {
|
||||
protected $elasticsearch;
|
||||
protected $index;
|
||||
|
||||
public function __construct(Client $connection, string $indexName) {
|
||||
$this->elasticsearch = $connection;
|
||||
$this->index = $indexName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param int $resultsPerContentType
|
||||
* @return array
|
||||
*/
|
||||
public function searchAllContent(string $query, int $resultsPerContentType = 10) {
|
||||
$results = $this->elasticsearch->msearch([
|
||||
'index' => $this->index,
|
||||
'body' => [
|
||||
//===== Tracks=====//
|
||||
['type' => 'track'],
|
||||
[
|
||||
'query' => [
|
||||
'multi_match' => [
|
||||
'query' => $query,
|
||||
'fields' => [
|
||||
'title',
|
||||
'artist',
|
||||
'genre',
|
||||
'track_type',
|
||||
'show_songs',
|
||||
],
|
||||
],
|
||||
],
|
||||
'size' => $resultsPerContentType
|
||||
],
|
||||
|
||||
//===== Albums =====//
|
||||
['type' => 'album'],
|
||||
[
|
||||
'query' => [
|
||||
'multi_match' => [
|
||||
'query' => $query,
|
||||
'fields' => [
|
||||
'title',
|
||||
'artist',
|
||||
'tracks',
|
||||
],
|
||||
],
|
||||
],
|
||||
'size' => $resultsPerContentType
|
||||
],
|
||||
|
||||
//===== Playlists =====//
|
||||
['type' => 'playlist'],
|
||||
[
|
||||
'query' => [
|
||||
'multi_match' => [
|
||||
'query' => $query,
|
||||
'fields' => [
|
||||
'title',
|
||||
'user',
|
||||
],
|
||||
],
|
||||
],
|
||||
'size' => $resultsPerContentType
|
||||
],
|
||||
|
||||
//===== Users =====//
|
||||
['type' => 'user'],
|
||||
[
|
||||
'query' => [
|
||||
'multi_match' => [
|
||||
'query' => $query,
|
||||
'fields' => [
|
||||
'display_name',
|
||||
],
|
||||
],
|
||||
],
|
||||
'size' => $resultsPerContentType
|
||||
],
|
||||
]
|
||||
]);
|
||||
|
||||
$tracks = $this->transformToEloquent(Track::class, $results['responses'][0]['hits']['hits']);
|
||||
$albums = $this->transformToEloquent(Album::class, $results['responses'][1]['hits']['hits']);
|
||||
$playlists = $this->transformToEloquent(Playlist::class, $results['responses'][2]['hits']['hits']);
|
||||
$users = $this->transformToEloquent(User::class, $results['responses'][3]['hits']['hits']);
|
||||
|
||||
return [
|
||||
'tracks' => $tracks,
|
||||
'albums' => $albums,
|
||||
'playlists' => $playlists,
|
||||
'users' => $users
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the given Elasticsearch results into a collection of corresponding
|
||||
* Eloquent models.
|
||||
*
|
||||
* This method assumes that the given class uses soft deletes.
|
||||
*
|
||||
* @param string $modelClass The Eloquent model class to instantiate these results as
|
||||
* @param array $searchHits
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
protected function transformToEloquent(string $modelClass, array $searchHits) {
|
||||
if (empty($searchHits)) {
|
||||
return new Collection();
|
||||
}
|
||||
|
||||
$ids = [];
|
||||
$caseStatement = 'CASE id ';
|
||||
|
||||
$i = 0;
|
||||
foreach ($searchHits as $result) {
|
||||
$ids[$result['_id']] = $result['_score'];
|
||||
$caseStatement .= "WHEN ${result['_id']} THEN $i ";
|
||||
$i++;
|
||||
}
|
||||
$caseStatement .= 'END';
|
||||
|
||||
$modelInstances = $modelClass::withTrashed()
|
||||
->whereIn('id', array_keys($ids))
|
||||
->orderBy(DB::raw($caseStatement))
|
||||
->get();
|
||||
|
||||
return $modelInstances;
|
||||
}
|
||||
}
|
|
@ -831,6 +831,8 @@ class Track extends Model
|
|||
return 'track-' . $this->id . '-' . $key;
|
||||
}
|
||||
|
||||
//============= Elasticsearch stuff ==================//
|
||||
|
||||
public function toElasticsearch() {
|
||||
return [
|
||||
'title' => $this->title,
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
namespace Poniverse\Ponyfm\Providers;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Database\SQLiteConnection;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use PfmValidator;
|
||||
|
@ -53,5 +51,12 @@ class AppServiceProvider extends ServiceProvider
|
|||
$this->app->bind(Poniverse::class, function(Application $app) {
|
||||
return new Poniverse($app['config']->get('poniverse.client_id'), $app['config']->get('poniverse.secret'));
|
||||
});
|
||||
|
||||
$this->app->bind(Poniverse\Ponyfm\Library\Search::class, function(Application $app) {
|
||||
return new Poniverse\Ponyfm\Library\Search(
|
||||
\Elasticsearch::connection(),
|
||||
$app['config']->get('ponyfm.elasticsearch_index')
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
254
composer.lock
generated
254
composer.lock
generated
|
@ -376,33 +376,33 @@
|
|||
},
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
"version": "v1.5.4",
|
||||
"version": "v1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/cache.git",
|
||||
"reference": "47cdc76ceb95cc591d9c79a36dc3794975b5d136"
|
||||
"reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/cache/zipball/47cdc76ceb95cc591d9c79a36dc3794975b5d136",
|
||||
"reference": "47cdc76ceb95cc591d9c79a36dc3794975b5d136",
|
||||
"url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6",
|
||||
"reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
"php": "~5.5|~7.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": ">2.2,<2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": ">=3.7",
|
||||
"phpunit/phpunit": "~4.8|~5.0",
|
||||
"predis/predis": "~1.0",
|
||||
"satooshi/php-coveralls": "~0.6"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.5.x-dev"
|
||||
"dev-master": "1.6.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -442,7 +442,7 @@
|
|||
"cache",
|
||||
"caching"
|
||||
],
|
||||
"time": "2015-12-19 05:03:47"
|
||||
"time": "2015-12-31 16:37:02"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/collections",
|
||||
|
@ -512,16 +512,16 @@
|
|||
},
|
||||
{
|
||||
"name": "doctrine/common",
|
||||
"version": "v2.5.2",
|
||||
"version": "v2.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/common.git",
|
||||
"reference": "311001fd9865a4d0d59efff4eac6d7dcb3f5270c"
|
||||
"reference": "a579557bc689580c19fee4e27487a67fe60defc0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/common/zipball/311001fd9865a4d0d59efff4eac6d7dcb3f5270c",
|
||||
"reference": "311001fd9865a4d0d59efff4eac6d7dcb3f5270c",
|
||||
"url": "https://api.github.com/repos/doctrine/common/zipball/a579557bc689580c19fee4e27487a67fe60defc0",
|
||||
"reference": "a579557bc689580c19fee4e27487a67fe60defc0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -530,20 +530,20 @@
|
|||
"doctrine/collections": "1.*",
|
||||
"doctrine/inflector": "1.*",
|
||||
"doctrine/lexer": "1.*",
|
||||
"php": ">=5.3.2"
|
||||
"php": "~5.5|~7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~3.7"
|
||||
"phpunit/phpunit": "~4.8|~5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5.x-dev"
|
||||
"dev-master": "2.7.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\Common\\": "lib/"
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\": "lib/Doctrine/Common"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
|
@ -581,24 +581,24 @@
|
|||
"persistence",
|
||||
"spl"
|
||||
],
|
||||
"time": "2015-12-04 12:49:42"
|
||||
"time": "2015-12-25 13:18:31"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/dbal",
|
||||
"version": "v2.5.2",
|
||||
"version": "v2.5.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/dbal.git",
|
||||
"reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c"
|
||||
"reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/dbal/zipball/01dbcbc5cd0a913d751418e635434a18a2f2a75c",
|
||||
"reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c",
|
||||
"url": "https://api.github.com/repos/doctrine/dbal/zipball/abbdfd1cff43a7b99d027af3be709bc8fc7d4769",
|
||||
"reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/common": ">=2.4,<2.6-dev",
|
||||
"doctrine/common": ">=2.4,<2.7-dev",
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -652,7 +652,7 @@
|
|||
"persistence",
|
||||
"queryobject"
|
||||
],
|
||||
"time": "2015-09-16 16:29:33"
|
||||
"time": "2016-01-05 22:11:12"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
|
@ -777,16 +777,16 @@
|
|||
},
|
||||
{
|
||||
"name": "elasticsearch/elasticsearch",
|
||||
"version": "v2.1.3",
|
||||
"version": "v2.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/elastic/elasticsearch-php.git",
|
||||
"reference": "7086a86cab241a77f19cdd653ae3d2e023b41699"
|
||||
"reference": "9ce5bd7606f6c185d434de4f80863f998f74e179"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/7086a86cab241a77f19cdd653ae3d2e023b41699",
|
||||
"reference": "7086a86cab241a77f19cdd653ae3d2e023b41699",
|
||||
"url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/9ce5bd7606f6c185d434de4f80863f998f74e179",
|
||||
"reference": "9ce5bd7606f6c185d434de4f80863f998f74e179",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -797,8 +797,8 @@
|
|||
"require-dev": {
|
||||
"athletic/athletic": "~0.1",
|
||||
"cpliakas/git-wrapper": "~1.0",
|
||||
"mockery/mockery": "0.9.4",
|
||||
"phpunit/phpunit": "~4.7",
|
||||
"mockery/mockery": "dev-master@dev",
|
||||
"phpunit/phpunit": "3.7.*",
|
||||
"symfony/yaml": "2.4.3 as 2.4.2",
|
||||
"twig/twig": "1.*"
|
||||
},
|
||||
|
@ -827,7 +827,7 @@
|
|||
"elasticsearch",
|
||||
"search"
|
||||
],
|
||||
"time": "2015-12-15 18:42:26"
|
||||
"time": "2015-11-05 15:29:21"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
|
@ -1333,16 +1333,16 @@
|
|||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v5.1.27",
|
||||
"version": "v5.1.28",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "b16f80878fd3603022d3c84593397cedd9af0bcf"
|
||||
"reference": "3f0fd27939dfdafb1e50058423cd24e640894ba2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/b16f80878fd3603022d3c84593397cedd9af0bcf",
|
||||
"reference": "b16f80878fd3603022d3c84593397cedd9af0bcf",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/3f0fd27939dfdafb1e50058423cd24e640894ba2",
|
||||
"reference": "3f0fd27939dfdafb1e50058423cd24e640894ba2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1457,7 +1457,7 @@
|
|||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2015-12-17 20:35:38"
|
||||
"time": "2015-12-31 17:41:30"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
|
@ -1764,16 +1764,16 @@
|
|||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "d762ee5b099a29044603cd4649851e81aa66cb47"
|
||||
"reference": "dd8998b7c846f6909f4e7a5f67fabebfc412a4f7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/d762ee5b099a29044603cd4649851e81aa66cb47",
|
||||
"reference": "d762ee5b099a29044603cd4649851e81aa66cb47",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/dd8998b7c846f6909f4e7a5f67fabebfc412a4f7",
|
||||
"reference": "dd8998b7c846f6909f4e7a5f67fabebfc412a4f7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1808,7 +1808,7 @@
|
|||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2015-12-10 14:48:13"
|
||||
"time": "2016-01-06 13:31:20"
|
||||
},
|
||||
{
|
||||
"name": "pda/pheanstalk",
|
||||
|
@ -2167,16 +2167,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/class-loader",
|
||||
"version": "v2.8.0",
|
||||
"version": "v2.8.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/class-loader.git",
|
||||
"reference": "51f83451bf0ddfc696e47e4642d6cd10fcfce160"
|
||||
"reference": "98e9089a428ed0e39423b67352c57ef5910a3269"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/class-loader/zipball/51f83451bf0ddfc696e47e4642d6cd10fcfce160",
|
||||
"reference": "51f83451bf0ddfc696e47e4642d6cd10fcfce160",
|
||||
"url": "https://api.github.com/repos/symfony/class-loader/zipball/98e9089a428ed0e39423b67352c57ef5910a3269",
|
||||
"reference": "98e9089a428ed0e39423b67352c57ef5910a3269",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2215,20 +2215,20 @@
|
|||
],
|
||||
"description": "Symfony ClassLoader Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-26 07:00:59"
|
||||
"time": "2016-01-03 15:33:41"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "16bb1cb86df43c90931df65f529e7ebd79636750"
|
||||
"reference": "d3fc138b6ed8f8074591821d3416d8f9c04d6ca6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/16bb1cb86df43c90931df65f529e7ebd79636750",
|
||||
"reference": "16bb1cb86df43c90931df65f529e7ebd79636750",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/d3fc138b6ed8f8074591821d3416d8f9c04d6ca6",
|
||||
"reference": "d3fc138b6ed8f8074591821d3416d8f9c04d6ca6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2274,20 +2274,20 @@
|
|||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-18 09:54:26"
|
||||
"time": "2016-01-14 08:26:43"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "abb47717fb88aebd9437da2fc8bb01a50a36679f"
|
||||
"reference": "1a869e59cc3b2802961fc2124139659e12b72fe5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/abb47717fb88aebd9437da2fc8bb01a50a36679f",
|
||||
"reference": "abb47717fb88aebd9437da2fc8bb01a50a36679f",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/1a869e59cc3b2802961fc2124139659e12b72fe5",
|
||||
"reference": "1a869e59cc3b2802961fc2124139659e12b72fe5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2327,20 +2327,20 @@
|
|||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-10-30 20:10:21"
|
||||
"time": "2016-01-03 15:32:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/debug.git",
|
||||
"reference": "0dbc119596f4afc82d9b2eb2a7e6a4af1ee763fa"
|
||||
"reference": "5aca4aa9600b943287b4a1799a4d1d78b5388175"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/0dbc119596f4afc82d9b2eb2a7e6a4af1ee763fa",
|
||||
"reference": "0dbc119596f4afc82d9b2eb2a7e6a4af1ee763fa",
|
||||
"url": "https://api.github.com/repos/symfony/debug/zipball/5aca4aa9600b943287b4a1799a4d1d78b5388175",
|
||||
"reference": "5aca4aa9600b943287b4a1799a4d1d78b5388175",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2384,20 +2384,20 @@
|
|||
],
|
||||
"description": "Symfony Debug Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-10-30 20:10:21"
|
||||
"time": "2016-01-13 07:57:33"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "b33593cbfe1d81b50d48353f338aca76a08658d8"
|
||||
"reference": "55cc79a177193eb3bd74ac54b353691fbb211d3a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b33593cbfe1d81b50d48353f338aca76a08658d8",
|
||||
"reference": "b33593cbfe1d81b50d48353f338aca76a08658d8",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/55cc79a177193eb3bd74ac54b353691fbb211d3a",
|
||||
"reference": "55cc79a177193eb3bd74ac54b353691fbb211d3a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2439,20 +2439,20 @@
|
|||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-02 20:20:53"
|
||||
"time": "2016-01-03 15:32:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v2.8.0",
|
||||
"version": "v2.8.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc"
|
||||
"reference": "ee278f7c851533e58ca307f66305ccb9188aceda"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc",
|
||||
"reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ee278f7c851533e58ca307f66305ccb9188aceda",
|
||||
"reference": "ee278f7c851533e58ca307f66305ccb9188aceda",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2499,20 +2499,20 @@
|
|||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-10-30 20:15:42"
|
||||
"time": "2016-01-13 10:28:07"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "a06a0c0ff7db3736a50d530c908cca547bf13da9"
|
||||
"reference": "d20ac81c81a67ab898b0c0afa435f3e9a7d460cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/a06a0c0ff7db3736a50d530c908cca547bf13da9",
|
||||
"reference": "a06a0c0ff7db3736a50d530c908cca547bf13da9",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/d20ac81c81a67ab898b0c0afa435f3e9a7d460cf",
|
||||
"reference": "d20ac81c81a67ab898b0c0afa435f3e9a7d460cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2548,20 +2548,20 @@
|
|||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-10-30 20:10:21"
|
||||
"time": "2016-01-14 08:26:43"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-foundation.git",
|
||||
"reference": "e83a3d105ddaf5a113e803c904fdec552d1f1c35"
|
||||
"reference": "2f9d240056f026af5f7ba7f7052b0c6709bf288c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/e83a3d105ddaf5a113e803c904fdec552d1f1c35",
|
||||
"reference": "e83a3d105ddaf5a113e803c904fdec552d1f1c35",
|
||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/2f9d240056f026af5f7ba7f7052b0c6709bf288c",
|
||||
"reference": "2f9d240056f026af5f7ba7f7052b0c6709bf288c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2603,20 +2603,20 @@
|
|||
],
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-20 17:41:18"
|
||||
"time": "2016-01-13 10:26:43"
|
||||
},
|
||||
{
|
||||
"name": "symfony/http-kernel",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/http-kernel.git",
|
||||
"reference": "5570de31e8fbc03777a8c61eb24f9b626e5e5941"
|
||||
"reference": "aa2f1e544d6cb862452504b5479a5095b7bfc53f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/5570de31e8fbc03777a8c61eb24f9b626e5e5941",
|
||||
"reference": "5570de31e8fbc03777a8c61eb24f9b626e5e5941",
|
||||
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/aa2f1e544d6cb862452504b5479a5095b7bfc53f",
|
||||
"reference": "aa2f1e544d6cb862452504b5479a5095b7bfc53f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2685,20 +2685,20 @@
|
|||
],
|
||||
"description": "Symfony HttpKernel Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-23 11:57:49"
|
||||
"time": "2016-01-14 10:41:45"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php56",
|
||||
"version": "v1.0.0",
|
||||
"version": "v1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php56.git",
|
||||
"reference": "a6bd4770a6967517e6610529e14afaa3111094a3"
|
||||
"reference": "e2e77609a9e2328eb370fbb0e0d8b2000ebb488f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/a6bd4770a6967517e6610529e14afaa3111094a3",
|
||||
"reference": "a6bd4770a6967517e6610529e14afaa3111094a3",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/e2e77609a9e2328eb370fbb0e0d8b2000ebb488f",
|
||||
"reference": "e2e77609a9e2328eb370fbb0e0d8b2000ebb488f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2741,11 +2741,11 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2015-11-04 20:28:58"
|
||||
"time": "2015-12-18 15:10:25"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-util",
|
||||
"version": "v1.0.0",
|
||||
"version": "v1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-util.git",
|
||||
|
@ -2797,16 +2797,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "f6290983c8725d0afa29bdc3e5295879de3e58f5"
|
||||
"reference": "0570b9ca51135ee7da0f19239eaf7b07ffb87034"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/f6290983c8725d0afa29bdc3e5295879de3e58f5",
|
||||
"reference": "f6290983c8725d0afa29bdc3e5295879de3e58f5",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/0570b9ca51135ee7da0f19239eaf7b07ffb87034",
|
||||
"reference": "0570b9ca51135ee7da0f19239eaf7b07ffb87034",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2842,20 +2842,20 @@
|
|||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-19 16:11:24"
|
||||
"time": "2016-01-06 09:57:37"
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/routing.git",
|
||||
"reference": "7450f6196711b124fb8b04a12286d01a0401ddfe"
|
||||
"reference": "6fec77993acfe19aecf60544b9c7d32f3d5b2506"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/7450f6196711b124fb8b04a12286d01a0401ddfe",
|
||||
"reference": "7450f6196711b124fb8b04a12286d01a0401ddfe",
|
||||
"url": "https://api.github.com/repos/symfony/routing/zipball/6fec77993acfe19aecf60544b9c7d32f3d5b2506",
|
||||
"reference": "6fec77993acfe19aecf60544b9c7d32f3d5b2506",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2915,20 +2915,20 @@
|
|||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2015-11-18 13:41:01"
|
||||
"time": "2016-01-03 15:32:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "e4ecb9c3ba1304eaf24de15c2d7a428101c1982f"
|
||||
"reference": "8cbab8445ad4269427077ba02fff8718cb397e22"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/e4ecb9c3ba1304eaf24de15c2d7a428101c1982f",
|
||||
"reference": "e4ecb9c3ba1304eaf24de15c2d7a428101c1982f",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/8cbab8445ad4269427077ba02fff8718cb397e22",
|
||||
"reference": "8cbab8445ad4269427077ba02fff8718cb397e22",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2978,20 +2978,20 @@
|
|||
],
|
||||
"description": "Symfony Translation Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-18 13:41:01"
|
||||
"time": "2016-01-03 15:32:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"version": "v2.7.7",
|
||||
"version": "v2.7.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-dumper.git",
|
||||
"reference": "72bcb27411780eaee9469729aace73c0d46fb2b8"
|
||||
"reference": "ad39199e91f2f845a0181b14d459fda13a622138"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/72bcb27411780eaee9469729aace73c0d46fb2b8",
|
||||
"reference": "72bcb27411780eaee9469729aace73c0d46fb2b8",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/ad39199e91f2f845a0181b14d459fda13a622138",
|
||||
"reference": "ad39199e91f2f845a0181b14d459fda13a622138",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3037,20 +3037,20 @@
|
|||
"debug",
|
||||
"dump"
|
||||
],
|
||||
"time": "2015-11-18 13:41:01"
|
||||
"time": "2016-01-07 11:12:32"
|
||||
},
|
||||
{
|
||||
"name": "venturecraft/revisionable",
|
||||
"version": "1.24.0",
|
||||
"version": "1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/VentureCraft/revisionable.git",
|
||||
"reference": "99c27d94f80ae9240cec89c4276f61e748e989a5"
|
||||
"reference": "7a3d5304de6c10d43cfb0d9ebe0bbdbb6e5b82ee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/VentureCraft/revisionable/zipball/99c27d94f80ae9240cec89c4276f61e748e989a5",
|
||||
"reference": "99c27d94f80ae9240cec89c4276f61e748e989a5",
|
||||
"url": "https://api.github.com/repos/VentureCraft/revisionable/zipball/7a3d5304de6c10d43cfb0d9ebe0bbdbb6e5b82ee",
|
||||
"reference": "7a3d5304de6c10d43cfb0d9ebe0bbdbb6e5b82ee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3085,7 +3085,7 @@
|
|||
"model",
|
||||
"revision"
|
||||
],
|
||||
"time": "2015-12-09 21:48:10"
|
||||
"time": "2016-01-13 12:14:05"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
|
@ -3387,16 +3387,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpspec/phpspec",
|
||||
"version": "2.4.0",
|
||||
"version": "2.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpspec/phpspec.git",
|
||||
"reference": "1d3938e6d9ffb1bd4805ea8ddac62ea48767f358"
|
||||
"reference": "5528ce1e93a1efa090c9404aba3395c329b4e6ed"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/1d3938e6d9ffb1bd4805ea8ddac62ea48767f358",
|
||||
"reference": "1d3938e6d9ffb1bd4805ea8ddac62ea48767f358",
|
||||
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/5528ce1e93a1efa090c9404aba3395c329b4e6ed",
|
||||
"reference": "5528ce1e93a1efa090c9404aba3395c329b4e6ed",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3461,7 +3461,7 @@
|
|||
"testing",
|
||||
"tests"
|
||||
],
|
||||
"time": "2015-11-29 02:03:49"
|
||||
"time": "2016-01-01 10:17:54"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
|
@ -4264,16 +4264,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v3.0.0",
|
||||
"version": "v3.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
"reference": "177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002"
|
||||
"reference": "3df409958a646dad2bc5046c3fb671ee24a1a691"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002",
|
||||
"reference": "177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002",
|
||||
"url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691",
|
||||
"reference": "3df409958a646dad2bc5046c3fb671ee24a1a691",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -4309,7 +4309,7 @@
|
|||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2015-11-30 12:36:17"
|
||||
"time": "2015-12-26 13:39:53"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
|
|
@ -56,7 +56,7 @@ return [
|
|||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Duration
|
||||
| Cache duration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Duration in minutes for track files to be stored in cache.
|
||||
|
@ -65,4 +65,15 @@ return [
|
|||
|
||||
'track_file_cache_duration' => 1440,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Elasticsearch index name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The name of the Elasticsearch index to store Pony.fm's search data in.
|
||||
|
|
||||
*/
|
||||
|
||||
'elasticsearch_index' => 'ponyfm',
|
||||
|
||||
];
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Poniverse\Ponyfm\Console\Commands\RebuildSearchIndex;
|
||||
use Poniverse\Ponyfm\Models\Track;
|
||||
|
||||
class SetupElasticsearch extends Migration
|
||||
{
|
||||
|
@ -44,13 +45,13 @@ class SetupElasticsearch extends Migration
|
|||
'title' => ['type' => 'string'],
|
||||
'artist' => ['type' => 'string'],
|
||||
'published_at' => ['type' => 'date'],
|
||||
'genre' => ['type' => 'string'],
|
||||
'track_type' => ['type' => 'string'],
|
||||
'genre' => ['type' => 'string', 'index' => 'not_analyzed'],
|
||||
'track_type' => ['type' => 'string', 'index' => 'not_analyzed'],
|
||||
|
||||
// This field is intended to be used as an array.
|
||||
// Note that all Elasticsearch fields can technically be used as arrays.
|
||||
// See: https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html
|
||||
'show_songs' => ['type' => 'string'],
|
||||
'show_songs' => ['type' => 'string', 'index' => 'not_analyzed'],
|
||||
]
|
||||
],
|
||||
|
||||
|
|
Loading…
Reference in a new issue