From 243dbfa9c24932812ee729d598d5784dbb87cd7c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 26 Dec 2024 22:11:34 +0800 Subject: [PATCH] :bug: Fix is indexable query filter issue --- pkg/internal/server/api/index_api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/internal/server/api/index_api.go b/pkg/internal/server/api/index_api.go index 063c792..cf38a53 100644 --- a/pkg/internal/server/api/index_api.go +++ b/pkg/internal/server/api/index_api.go @@ -44,6 +44,8 @@ func listAttachment(c *fiber.Ctx) error { tx = tx.Where("rid IN ?", pendingQueryId) needQuery = len(pendingQueryId) > 0 } else { + tx = tx.Where("is_indexable IS NULL OR is_indexable = ?", true) + // Do sort this when doesn't filter by the id // Because the sort will mess up the result tx = tx.Order("created_at DESC") @@ -74,8 +76,6 @@ func listAttachment(c *fiber.Ctx) error { tx = tx.Where("ref_id IS NULL") } - tx = tx.Where("is_indexable != ?", false) - var count int64 countTx := tx if err := countTx.Model(&models.Attachment{}).Count(&count).Error; err != nil {