From c6f2b92e052a71cedadac95d6f781a8d70d49e4c Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Wed, 19 Jan 2022 15:52:52 +0100 Subject: [PATCH] mapping des dates pour sorting correct via elastic search --- app/Console/Commands/reindexElasticMedia.php | 9 +++++++-- app/Models/Media.php | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/Console/Commands/reindexElasticMedia.php b/app/Console/Commands/reindexElasticMedia.php index 61dac39..1744c68 100644 --- a/app/Console/Commands/reindexElasticMedia.php +++ b/app/Console/Commands/reindexElasticMedia.php @@ -47,11 +47,16 @@ class reindexElasticMedia extends Command } else { $startFrom = 1; } - if (Media::indexExists() && !$bReprise) + $this->info('Test Présence...'); + if (Media::indexExists() && !$bReprise) { + $this->info('Suppression index...'); Media::deleteIndex(); + } - if(!$bReprise) + if(!$bReprise) { + $this->info('Création...'); Media::createIndex(); + } $medias = Media::all(); $bar = $this->output->createProgressBar(count($medias)); diff --git a/app/Models/Media.php b/app/Models/Media.php index f1a8bb7..e5d1d03 100644 --- a/app/Models/Media.php +++ b/app/Models/Media.php @@ -94,12 +94,14 @@ class Media extends Model 'fielddata' => true ), 'created_at' => array( - 'type' => 'text', - 'fielddata' => true + 'type' => 'date', + "format" => "yyyy-MM-dd HH:mm:ss", + //'fielddata' => true ), 'updated_at' => array( - 'type' => 'text', - 'fielddata' => true + 'type' => 'date', + "format" => "yyyy-MM-dd HH:mm:ss", + //'fielddata' => true ), 'version' => array( 'type' => 'text',