From 0efc4c69e929f103f9469d8ded96ef562a529393 Mon Sep 17 00:00:00 2001 From: Kevin Meijer Date: Wed, 28 Jan 2026 16:38:42 +0100 Subject: [PATCH 1/2] Fixed created_at sorting attribute --- src/Http/Controllers/ConfigController.php | 2 +- src/Models/Traits/Product/Searchable.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Http/Controllers/ConfigController.php b/src/Http/Controllers/ConfigController.php index 689a25dfb..eea20c781 100644 --- a/src/Http/Controllers/ConfigController.php +++ b/src/Http/Controllers/ConfigController.php @@ -249,7 +249,7 @@ public function getSearchkitSorting(): array "rapidez::frontend.sorting.{$attribute['code']}.{$direction}", trans_fallback("rapidez::frontend.{$attribute['code']}", ucfirst($attribute['code'])) . ' ' . trans_fallback("rapidez::frontend.{$direction}", $direction), ), - 'field' => $attribute['code'] . ($attribute['input'] == 'text' ? '.keyword' : ''), + 'field' => $attribute['code'] . ($attribute['code'] !== 'created_at' && $attribute['input'] == 'text' ? '.keyword' : ''), 'order' => $direction, 'value' => "{$index}_{$attribute['code']}_{$direction}", 'key' => "_{$attribute['code']}_{$direction}", diff --git a/src/Models/Traits/Product/Searchable.php b/src/Models/Traits/Product/Searchable.php index 37ecd09f4..7728b8caa 100644 --- a/src/Models/Traits/Product/Searchable.php +++ b/src/Models/Traits/Product/Searchable.php @@ -168,6 +168,10 @@ protected static function indexMapping(): array return false; } + if (in_array($attribute['code'], ['created_at'])) { + return true; + } + if (in_array($attribute['type'], ['varchar', 'text', 'gallery', 'static'])) { // Types best left up to ES to interpret the type. return false; From 09e700a14c9fe36d5d89e73fcab50d015b27adee Mon Sep 17 00:00:00 2001 From: Kevin Meijer Date: Wed, 28 Jan 2026 16:40:07 +0100 Subject: [PATCH 2/2] Fixed map --- src/Models/Traits/Product/Searchable.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Models/Traits/Product/Searchable.php b/src/Models/Traits/Product/Searchable.php index 7728b8caa..cd56ef69e 100644 --- a/src/Models/Traits/Product/Searchable.php +++ b/src/Models/Traits/Product/Searchable.php @@ -200,7 +200,11 @@ protected static function indexMapping(): array }) ) ->pluck('type', 'code') - ->map(function ($type) { + ->map(function ($type, $code) { + if (in_array($code, ['created_at'])) { + $type = 'datetime'; + } + return array_filter([ 'type' => match ($type) { 'int' => 'integer',