From 5e1a51b028983c811373da7390f4765058886648 Mon Sep 17 00:00:00 2001 From: sysops Date: Sun, 10 May 2026 22:53:27 +0200 Subject: [PATCH] fix(PROJ-44): SNIPPET via SELECT statt CALL SNIPPETS (Go MySQL-Treiber-Kompatibilitaet) CALL SNIPPETS liefert einen anderen MySQL-Pakettyp als SELECT, den der Go-Treiber (go-sql-driver/mysql) mit "malformed packet" ablehnt. SELECT SNIPPET(text, query) FROM table ist die korrekte Alternative fuer Manticore 25. Co-Authored-By: Claude Sonnet 4.6 --- internal/index/manticore_snippet.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/index/manticore_snippet.go b/internal/index/manticore_snippet.go index 0152bb1..45e2987 100644 --- a/internal/index/manticore_snippet.go +++ b/internal/index/manticore_snippet.go @@ -102,14 +102,12 @@ func (idx *manticoreIndex) buildSnippet(mailID, query, matchField string) (strin return "", nil } - // CALL SNIPPETS(text, table, query). - // Manticore 25+ accepts exactly 3 arguments; options-as-extra-args were - // removed in this version. Default markers are already /, which is - // what we need. Manticore returns a single-column, single-row result. - row := idx.db.QueryRow( - `CALL SNIPPETS(?, ?, ?)`, - source, idx.table, query, - ) + // SELECT SNIPPET(text, query) FROM table. + // Manticore 25+ supports SNIPPET() as a SELECT expression; CALL SNIPPETS + // returns a different packet type that the Go MySQL driver mishandles + // ("malformed packet"). Default markers are /, no options needed. + q := fmt.Sprintf(`SELECT SNIPPET(?, ?) FROM %s LIMIT 1`, idx.table) + row := idx.db.QueryRow(q, source, query) var snippet string if err := row.Scan(&snippet); err != nil { return "", fmt.Errorf("call snippets %s: %w", idx.table, err)