From 9601389d839e44c23001f1514eb0fb092e824af5 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Thu, 27 May 2021 11:28:57 +0200 Subject: [PATCH] - Bug: data serialisaion on laravel 7.x (Coverage.php) - solr path without solr string - composer updates --- app/Models/Coverage.php | 11 +++++++++++ app/Observers/DatasetObserver.php | 7 +++---- composer.lock | 10 +++++----- config/solarium.php | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/Models/Coverage.php b/app/Models/Coverage.php index aaf95b2..4dbc391 100644 --- a/app/Models/Coverage.php +++ b/app/Models/Coverage.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Models\Dataset; use Illuminate\Database\Eloquent\Model; +use DateTimeInterface; class Coverage extends Model { @@ -47,6 +48,16 @@ class Coverage extends Model { $this->attributes['time_max'] = empty($date) ? null : \Illuminate\Support\Carbon::createFromFormat('Y-m-d H:i:s', $date); } + /** + * Prepare a date for array / JSON serialization. + * + * @param \DateTimeInterface $date + * @return string + */ + protected function serializeDate(DateTimeInterface $date) + { + return $date->format('Y-m-d H:i:s'); + } /** * relationship to dataset diff --git a/app/Observers/DatasetObserver.php b/app/Observers/DatasetObserver.php index 247534f..45fee6b 100644 --- a/app/Observers/DatasetObserver.php +++ b/app/Observers/DatasetObserver.php @@ -6,6 +6,7 @@ namespace App\Observers; use App\Models\Dataset; use Illuminate\Support\Facades\Log; use App\Library\Search\SolariumAdapter; +use \Exception; class DatasetObserver { @@ -92,10 +93,8 @@ class DatasetObserver // Opus_Search_Service::selectIndexingService('onDocumentChange') $service = new SolariumAdapter("solr", config('solarium')); $service->addDatasetsToIndex($dataset); - } catch (Opus_Search_Exception $e) { - Log::debug(__METHOD__ . ': ' . 'Indexing document ' . $datasetId . ' failed: ' . $e->getMessage()); - } catch (InvalidArgumentException $e) { - Log::warning(__METHOD__ . ': ' . $e->getMessage()); + } catch (Exception $e) { + Log::error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage()); } } } diff --git a/composer.lock b/composer.lock index ea15f55..517cfb9 100755 --- a/composer.lock +++ b/composer.lock @@ -2200,16 +2200,16 @@ }, { "name": "nesbot/carbon", - "version": "2.48.0", + "version": "2.48.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "d3c447f21072766cddec3522f9468a5849a76147" + "reference": "8d1f50f1436fb4b05e7127360483dd9c6e73da16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3c447f21072766cddec3522f9468a5849a76147", - "reference": "d3c447f21072766cddec3522f9468a5849a76147", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8d1f50f1436fb4b05e7127360483dd9c6e73da16", + "reference": "8d1f50f1436fb4b05e7127360483dd9c6e73da16", "shasum": "" }, "require": { @@ -2289,7 +2289,7 @@ "type": "tidelift" } ], - "time": "2021-05-07T10:08:30+00:00" + "time": "2021-05-26T22:08:38+00:00" }, { "name": "nikic/php-parser", diff --git a/config/solarium.php b/config/solarium.php index bea3fb2..d13c652 100644 --- a/config/solarium.php +++ b/config/solarium.php @@ -5,7 +5,7 @@ return [ 'repository' => [ 'host' => env('SOLR_HOST', 'repository.geologie.ac.at'), 'port' => env('SOLR_PORT', '8983'), - 'path' => env('SOLR_PATH', '/solr/'), + 'path' => env('SOLR_PATH', '/'), 'core' => env('SOLR_CORE', 'rdr_data') ] ],