From 1086bc78b9e457aea224fa1182513e2cada52c26 Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Fri, 10 Apr 2026 02:32:45 +0800 Subject: [PATCH] fix(search): fix parameter type error for single-word queries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only allocate per-term SQL parameters when there are multiple search terms. For single-word queries, the phrase parameter already covers the search — unused term params caused PostgreSQL error "could not determine data type of parameter $3". Co-Authored-By: Claude Opus 4.6 (1M context) --- server/internal/handler/issue.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/internal/handler/issue.go b/server/internal/handler/issue.go index c5622ad7b..82bbb7f56 100644 --- a/server/internal/handler/issue.go +++ b/server/internal/handler/issue.go @@ -242,14 +242,14 @@ func buildSearchQuery(phrase string, terms []string, queryNum int, hasNum bool, wsParam := nextArg(nil) // $2 — workspace_id, will be filled by caller position - // Build per-term ILIKE conditions for multi-word search. - // Each term must match somewhere in title, description, or comments. - var escapedTerms []string + // Build per-term ILIKE conditions only for multi-word search. + // For single-word queries, the phrase parameter already covers the term. var termParams []string - for _, t := range terms { - et := escapeLike(t) - escapedTerms = append(escapedTerms, et) - termParams = append(termParams, nextArg(et)) + if len(terms) > 1 { + for _, t := range terms { + et := escapeLike(t) + termParams = append(termParams, nextArg(et)) + } } // --- WHERE clause ---