diff --git a/pkg/internal/services/posts.go b/pkg/internal/services/posts.go index 36f1ef0..9d7c45d 100644 --- a/pkg/internal/services/posts.go +++ b/pkg/internal/services/posts.go @@ -99,7 +99,10 @@ func FilterPostDraft(tx *gorm.DB) *gorm.DB { func FilterPostWithFuzzySearch(tx *gorm.DB, probe string) *gorm.DB { probe = "%" + probe + "%" - return tx.Where("? AND body->>'content' ILIKE ?", gorm.Expr("body ? 'content'"), probe) + return tx. + Where("? AND body->>'content' ILIKE ?", gorm.Expr("body ? 'content'"), probe). + Or("? AND body->>'title' ILIKE ?", gorm.Expr("body ? 'title'"), probe). + Or("? AND body->>'description' ILIKE ?", gorm.Expr("body ? 'description'"), probe) } func PreloadGeneral(tx *gorm.DB) *gorm.DB {