mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-26 12:35:35 +02:00
fix(search): fix parameter type error for single-word queries
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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 ---
|
||||
|
||||
Reference in New Issue
Block a user