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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 <b>/<b/>, 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 <b>/<b/>, 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)
|
||||
|
||||
Reference in New Issue
Block a user