- add SolrIndexBuilder artisan command
- Sitelinkcontroller: data filter via raw sql - primary key for HasValue model - config/solarium.php new config values - bug on migration fie for document_xml_cache
This commit is contained in:
parent
54edfb4617
commit
084a1a2b8c
60
app/Console/Commands/SolrIndexBuilder.php
Normal file
60
app/Console/Commands/SolrIndexBuilder.php
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Models\Dataset;
|
||||||
|
// use Illuminate\Support\Facades\Log;
|
||||||
|
// use App\Library\Search\SolariumAdapter;
|
||||||
|
|
||||||
|
class SolrIndexBuilder extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'index:dataset';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Indexes all datasets';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$datasets = Dataset::where('server_state', 'published')->get();
|
||||||
|
|
||||||
|
// update statistics table
|
||||||
|
foreach ($datasets as $dataset) {
|
||||||
|
$datasetId = $dataset->id;
|
||||||
|
$time = new \Illuminate\Support\Carbon();
|
||||||
|
$dataset->server_date_published = $time;
|
||||||
|
$dataset->save();
|
||||||
|
// try {
|
||||||
|
// // Opus_Search_Service::selectIndexingService('onDocumentChange')
|
||||||
|
// $service = new SolariumAdapter("solr", config('solarium'));
|
||||||
|
// $service->addDatasetsToIndex($dataset);
|
||||||
|
// } catch (Exception $e) {
|
||||||
|
// Log::debug(__METHOD__ . ': ' . 'Indexing document ' . $datasetId . ' failed: ' . $e->getMessage());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,8 @@ class Kernel extends ConsoleKernel
|
||||||
*/
|
*/
|
||||||
protected $commands = [
|
protected $commands = [
|
||||||
'App\Console\Commands\Inspire',
|
'App\Console\Commands\Inspire',
|
||||||
'App\Console\Commands\DatasetState'
|
'App\Console\Commands\DatasetState',
|
||||||
|
'App\Console\Commands\SolrIndexBuilder'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,20 +16,21 @@ class SitelinkController extends Controller
|
||||||
$select = DB::table('documents')
|
$select = DB::table('documents')
|
||||||
->where('server_state', 'LIKE', "%" . $serverState . "%");
|
->where('server_state', 'LIKE', "%" . $serverState . "%");
|
||||||
|
|
||||||
// $select
|
$select
|
||||||
// ->select(DB::raw('EXTRACT(YEAR FROM server_date_published) as published_date'))
|
->select(DB::raw('EXTRACT(YEAR FROM server_date_published) as published_date'))
|
||||||
// // ->select(DB::raw("DATE_PART('year', server_date_published) as published_date"))
|
// ->select(DB::raw("DATE_PART('year', server_date_published) as published_date"))
|
||||||
// // ->select(DB::raw("YEAR(server_date_published) AS published_date"))
|
// ->select(DB::raw("YEAR(server_date_published) AS published_date"))
|
||||||
// ->distinct(true);
|
->distinct(true);
|
||||||
|
$this->years = $select->pluck('published_date')->toArray();
|
||||||
|
|
||||||
$years = $select->pluck('server_date_published')->toArray();
|
// $years = $select->pluck('server_date_published')->toArray();
|
||||||
$this->years = array_map(function ($pdate) {
|
// $this->years = array_map(function ($pdate) {
|
||||||
$dateValue = strtotime($pdate);
|
// $dateValue = strtotime($pdate);
|
||||||
if ($dateValue != false) {
|
// if ($dateValue != false) {
|
||||||
$year = date("Y", $dateValue);
|
// $year = date("Y", $dateValue);
|
||||||
return $year;
|
// return $year;
|
||||||
}
|
// }
|
||||||
}, $years);
|
// }, $years);
|
||||||
$this->ids = array();
|
$this->ids = array();
|
||||||
return view('frontend.sitelink.index')->with(['years' => $this->years, 'documents' => $this->ids]);
|
return view('frontend.sitelink.index')->with(['years' => $this->years, 'documents' => $this->ids]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ class HashValue extends Model
|
||||||
protected $table = 'file_hashvalues';
|
protected $table = 'file_hashvalues';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
protected $primaryKey = ['file_id', 'type'];
|
||||||
|
public $incrementing = false;
|
||||||
|
|
||||||
public function file()
|
public function file()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(File::class, 'file_id', 'id');
|
return $this->belongsTo(File::class, 'file_id', 'id');
|
||||||
|
|
134
composer.lock
generated
134
composer.lock
generated
|
@ -8,26 +8,27 @@
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "astrotomic/laravel-translatable",
|
"name": "astrotomic/laravel-translatable",
|
||||||
"version": "v11.3.0",
|
"version": "v11.5.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Astrotomic/laravel-translatable.git",
|
"url": "https://github.com/Astrotomic/laravel-translatable.git",
|
||||||
"reference": "9bf19f56d4e924f1381176a1dfc47d423948001d"
|
"reference": "078a22ea96582f7f518f5418ee7e57e3746fb032"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/Astrotomic/laravel-translatable/zipball/9bf19f56d4e924f1381176a1dfc47d423948001d",
|
"url": "https://api.github.com/repos/Astrotomic/laravel-translatable/zipball/078a22ea96582f7f518f5418ee7e57e3746fb032",
|
||||||
"reference": "9bf19f56d4e924f1381176a1dfc47d423948001d",
|
"reference": "078a22ea96582f7f518f5418ee7e57e3746fb032",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"illuminate/contracts": "5.6.*|5.7.*|5.8.*",
|
"illuminate/contracts": "5.6.* || 5.7.* || 5.8.* || ^6.0",
|
||||||
"illuminate/database": "5.6.*|5.7.*|5.8.*",
|
"illuminate/database": "5.6.* || 5.7.* || 5.8.* || ^6.0",
|
||||||
"illuminate/support": "5.6.*|5.7.*|5.8.*",
|
"illuminate/support": "5.6.* || 5.7.* || 5.8.* || ^6.0",
|
||||||
"php": ">=7.1.3"
|
"php": ">=7.1.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"orchestra/testbench": "3.6.*|3.7.*|3.8.*"
|
"orchestra/testbench": "3.6.* || 3.7.* || 3.8.* || ^4.0",
|
||||||
|
"orchestra/testbench-core": "3.6.* || 3.7.* || 3.8.* || ^4.0"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -49,15 +50,15 @@
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Tom Witkowski",
|
"name": "Tom Witkowski",
|
||||||
"role": "Developer",
|
|
||||||
"email": "dev.gummibeer@gmail.com",
|
"email": "dev.gummibeer@gmail.com",
|
||||||
"homepage": "https://gummibeer.de"
|
"homepage": "https://gummibeer.de",
|
||||||
|
"role": "Developer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Dimitrios Savvopoulos",
|
"name": "Dimitrios Savvopoulos",
|
||||||
"role": "Developer",
|
|
||||||
"email": "ds@dimsav.com",
|
"email": "ds@dimsav.com",
|
||||||
"homepage": "http://dimsav.com"
|
"homepage": "http://dimsav.com",
|
||||||
|
"role": "Developer"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "A Laravel package for multilingual models",
|
"description": "A Laravel package for multilingual models",
|
||||||
|
@ -67,32 +68,33 @@
|
||||||
"laravel",
|
"laravel",
|
||||||
"translation"
|
"translation"
|
||||||
],
|
],
|
||||||
"time": "2019-08-07T10:12:15+00:00"
|
"time": "2019-09-05T13:59:22+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "davejamesmiller/laravel-breadcrumbs",
|
"name": "davejamesmiller/laravel-breadcrumbs",
|
||||||
"version": "5.2.1",
|
"version": "5.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/davejamesmiller/laravel-breadcrumbs.git",
|
"url": "https://github.com/davejamesmiller/laravel-breadcrumbs.git",
|
||||||
"reference": "6465e8710341578092fdd8aea24319d4f53ab27c"
|
"reference": "1edeee4a77f467293aa5e5ea4a0b8f010216b8da"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/zipball/6465e8710341578092fdd8aea24319d4f53ab27c",
|
"url": "https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/zipball/1edeee4a77f467293aa5e5ea4a0b8f010216b8da",
|
||||||
"reference": "6465e8710341578092fdd8aea24319d4f53ab27c",
|
"reference": "1edeee4a77f467293aa5e5ea4a0b8f010216b8da",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"illuminate/support": "5.6.*|5.7.*|5.8.*",
|
"facade/ignition-contracts": "^1.0",
|
||||||
"illuminate/view": "5.6.*|5.7.*|5.8.*",
|
"illuminate/support": "^5.6|^6.0",
|
||||||
|
"illuminate/view": "^5.6|^6.0",
|
||||||
"php": ">=7.1.3"
|
"php": ">=7.1.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"laravel/framework": "5.6.*|5.7.*|5.8.*",
|
"orchestra/testbench": "^3.6",
|
||||||
"orchestra/testbench": "3.6.*|3.7.*|3.8.*",
|
|
||||||
"php-coveralls/php-coveralls": "^1.0",
|
"php-coveralls/php-coveralls": "^1.0",
|
||||||
"phpunit/phpunit": "7.*"
|
"phpunit/phpunit": "^7.0|^8.0",
|
||||||
|
"spatie/phpunit-snapshot-assertions": "^2.0"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
@ -125,7 +127,7 @@
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"laravel"
|
"laravel"
|
||||||
],
|
],
|
||||||
"time": "2019-02-27T13:09:37+00:00"
|
"time": "2019-09-03T15:24:57+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dnoegel/php-xdg-base-dir",
|
"name": "dnoegel/php-xdg-base-dir",
|
||||||
|
@ -447,6 +449,50 @@
|
||||||
],
|
],
|
||||||
"time": "2019-03-17T18:48:37+00:00"
|
"time": "2019-03-17T18:48:37+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "facade/ignition-contracts",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/facade/ignition-contracts.git",
|
||||||
|
"reference": "f445db0fb86f48e205787b2592840dd9c80ded28"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/facade/ignition-contracts/zipball/f445db0fb86f48e205787b2592840dd9c80ded28",
|
||||||
|
"reference": "f445db0fb86f48e205787b2592840dd9c80ded28",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Facade\\IgnitionContracts\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Freek Van der Herten",
|
||||||
|
"email": "freek@spatie.be",
|
||||||
|
"homepage": "https://flareapp.io",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Solution contracts for Ignition",
|
||||||
|
"homepage": "https://github.com/facade/ignition-contracts",
|
||||||
|
"keywords": [
|
||||||
|
"contracts",
|
||||||
|
"flare",
|
||||||
|
"ignition"
|
||||||
|
],
|
||||||
|
"time": "2019-08-30T14:06:08+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "felixkiss/uniquewith-validator",
|
"name": "felixkiss/uniquewith-validator",
|
||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
|
@ -502,25 +548,25 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fideloper/proxy",
|
"name": "fideloper/proxy",
|
||||||
"version": "4.2.0",
|
"version": "4.2.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/fideloper/TrustedProxy.git",
|
"url": "https://github.com/fideloper/TrustedProxy.git",
|
||||||
"reference": "39a4c2165e578bc771f5dc031c273210a3a9b6d2"
|
"reference": "03085e58ec7bee24773fa5a8850751a6e61a7e8a"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/39a4c2165e578bc771f5dc031c273210a3a9b6d2",
|
"url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/03085e58ec7bee24773fa5a8850751a6e61a7e8a",
|
||||||
"reference": "39a4c2165e578bc771f5dc031c273210a3a9b6d2",
|
"reference": "03085e58ec7bee24773fa5a8850751a6e61a7e8a",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"illuminate/contracts": "~5.0|~6.0",
|
"illuminate/contracts": "^5.0|^6.0|^7.0",
|
||||||
"php": ">=5.4.0"
|
"php": ">=5.4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"illuminate/http": "~5.6|~6.0",
|
"illuminate/http": "^5.0|^6.0|^7.0",
|
||||||
"mockery/mockery": "~1.0",
|
"mockery/mockery": "^1.0",
|
||||||
"phpunit/phpunit": "^6.0"
|
"phpunit/phpunit": "^6.0"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
|
@ -552,7 +598,7 @@
|
||||||
"proxy",
|
"proxy",
|
||||||
"trusted proxy"
|
"trusted proxy"
|
||||||
],
|
],
|
||||||
"time": "2019-07-29T16:49:45+00:00"
|
"time": "2019-09-03T16:45:42+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jakub-onderka/php-console-color",
|
"name": "jakub-onderka/php-console-color",
|
||||||
|
@ -1043,24 +1089,24 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mcamara/laravel-localization",
|
"name": "mcamara/laravel-localization",
|
||||||
"version": "1.3.20",
|
"version": "1.4.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/mcamara/laravel-localization.git",
|
"url": "https://github.com/mcamara/laravel-localization.git",
|
||||||
"reference": "af8f9f30488a83533dda3870fcc335b55cf964e0"
|
"reference": "7d6f2de6e020be33164da93af35e5f9bb52a3d89"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/mcamara/laravel-localization/zipball/af8f9f30488a83533dda3870fcc335b55cf964e0",
|
"url": "https://api.github.com/repos/mcamara/laravel-localization/zipball/7d6f2de6e020be33164da93af35e5f9bb52a3d89",
|
||||||
"reference": "af8f9f30488a83533dda3870fcc335b55cf964e0",
|
"reference": "7d6f2de6e020be33164da93af35e5f9bb52a3d89",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"laravel/framework": "~5.2.0||~5.3.0||~5.4.0||~5.5.0||~5.6.0||~5.7.0||~5.8.0",
|
"laravel/framework": "~5.2.0||~5.3.0||~5.4.0||~5.5.0||~5.6.0||~5.7.0||~5.8.0||~6.0.0",
|
||||||
"php": ">=7.0.0"
|
"php": ">=7.1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"orchestra/testbench-browser-kit": "~3.4|~3.8",
|
"orchestra/testbench-browser-kit": "~3.4|~3.8|~4.0",
|
||||||
"phpunit/phpunit": "6.0.*|8.0.*"
|
"phpunit/phpunit": "6.0.*|8.0.*"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
@ -1101,20 +1147,20 @@
|
||||||
"localization",
|
"localization",
|
||||||
"php"
|
"php"
|
||||||
],
|
],
|
||||||
"time": "2019-06-28T16:04:56+00:00"
|
"time": "2019-09-06T07:38:59+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "monolog/monolog",
|
"name": "monolog/monolog",
|
||||||
"version": "1.24.0",
|
"version": "1.25.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/Seldaek/monolog.git",
|
"url": "https://github.com/Seldaek/monolog.git",
|
||||||
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266"
|
"reference": "c5dcc05defbaf8780c728c1ea31b1a0704d44f56"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
|
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/c5dcc05defbaf8780c728c1ea31b1a0704d44f56",
|
||||||
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
|
"reference": "c5dcc05defbaf8780c728c1ea31b1a0704d44f56",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1179,7 +1225,7 @@
|
||||||
"logging",
|
"logging",
|
||||||
"psr-3"
|
"psr-3"
|
||||||
],
|
],
|
||||||
"time": "2018-11-05T09:00:11+00:00"
|
"time": "2019-09-06T12:21:24+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nesbot/carbon",
|
"name": "nesbot/carbon",
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
return [
|
return [
|
||||||
'endpoint' => [
|
'endpoint' => [
|
||||||
'localhost' => [
|
'localhost' => [
|
||||||
'host' => env('SOLR_HOST', 'zontik.gba.geolba.ac.at'),
|
'host' => env('SOLR_HOST', 'repository.geologie.ac.at'),
|
||||||
'port' => env('SOLR_PORT', '8983'),
|
'port' => env('SOLR_PORT', '8983'),
|
||||||
'path' => env('SOLR_PATH', '/solr/'),
|
'path' => env('SOLR_PATH', '/solr/'),
|
||||||
'core' => env('SOLR_CORE', 'opus4')
|
'core' => env('SOLR_CORE', 'rdr_data')
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'xsltfile' => "solr.xslt"
|
'xsltfile' => "public/solr.xslt"
|
||||||
];
|
];
|
||||||
|
|
|
@ -14,10 +14,10 @@ class CreateDocumentXmlCacheTable extends Migration
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::create('document_xml_cache', function (Blueprint $table) {
|
Schema::create('document_xml_cache', function (Blueprint $table) {
|
||||||
$table->integer('id')->primary();
|
$table->integer('document_id')->primary();
|
||||||
$table->integer('xml_version');
|
$table->integer('xml_version');
|
||||||
$table->string('server_date_modified', 50)->nullable();
|
$table->string('server_date_modified', 50)->nullable();
|
||||||
$table->string('xml_data')->nullable();
|
$table->text('xml_data')->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user