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)