From d90e89067de727f8b44af7f6faf5fc7d91b6a911 Mon Sep 17 00:00:00 2001 From: Jianyun Date: Thu, 22 Aug 2024 11:29:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A2=E5=BC=95=E5=88=87=E6=8D=A2=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=BA=94=E7=94=A8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/calibre/api.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/calibre/api.go b/internal/calibre/api.go index 2ffdd12..411f711 100644 --- a/internal/calibre/api.go +++ b/internal/calibre/api.go @@ -381,8 +381,12 @@ func (c Api) updateIndex(c2 *gin.Context) { c2.JSON(http.StatusOK, gin.H{"code": 500, "error": err2.Error()}) return } - - index := c.client.Index(c.config.Search.Index + "-bak") + index := c.currentIndex() + if c.useIndex == c.config.Search.Index { + index = c.client.Index(c.config.Search.Index) + } else { + index = c.client.Index(c.config.Search.Index + "-bak") + } _, err := index.DeleteAllDocuments() if err != nil { log.Warn(err)