From 8d4a595b75b6a29d64d83846258f241bde410f07 Mon Sep 17 00:00:00 2001 From: pushrbx Date: Wed, 31 Jan 2024 18:33:32 +0000 Subject: [PATCH] fixed indexing issue with typesense - all models have a "title" field, and that's the default sorting field, however this is not being indexed as such for the models, except where explicitly specified (Anime and Manga models) --- app/JikanApiSearchableModel.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/JikanApiSearchableModel.php b/app/JikanApiSearchableModel.php index 3d5ae20..01c5e76 100644 --- a/app/JikanApiSearchableModel.php +++ b/app/JikanApiSearchableModel.php @@ -21,12 +21,20 @@ abstract class JikanApiSearchableModel extends JikanApiModel implements Typesens */ public function getCollectionSchema(): array { + $titleAttributeName = $this->getTitleAttributeName(); + return [ 'name' => $this->searchableAs(), 'fields' => [ [ 'name' => '.*', 'type' => 'auto', + ], + [ + 'name' => $titleAttributeName, + 'type' => 'string', + 'sort' => true, + 'optional' => false ] ] ];