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 {