From dd29977e30f6c87fcd7de1ece79c077241afc0a8 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Yuusuke Date: Mon, 1 May 2023 01:02:45 +0900 Subject: [PATCH] =?UTF-8?q?tmpIndex=E3=81=AE=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meili/meilisearch.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/meili/meilisearch.go b/meili/meilisearch.go index b59e5bf..438aa9f 100644 --- a/meili/meilisearch.go +++ b/meili/meilisearch.go @@ -121,8 +121,18 @@ func max(a, b int) int { } func (m *MeiliSearchClient) UpdateRecordedFiles(rows []db.ListRecordedFilesRow) error { + if _, err := m.client.CreateIndex(&meilisearch.IndexConfig{Uid: temporarilyRecordedFileIndexName, PrimaryKey: "id"}); err != nil { + return err + } tmpIndex := m.Index(temporarilyRecordedFileIndexName) + if _, err := tmpIndex.UpdateSearchableAttributes(&[]string{"タイトル", "番組説明", "ジャンル", "番組詳細", "チャンネル名", "ARIB字幕", "文字起こし"}); err != nil { + return err + } + if _, err := tmpIndex.UpdateFilterableAttributes(&[]string{"チャンネル名", "ジャンル"}); err != nil { + return err + } + documents := make([]map[string]interface{}, 0, len(rows)) for idx, row := range rows { document := map[string]interface{}{