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
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CALL SNIPPETS(text, table, query).
|
// SELECT SNIPPET(text, query) FROM table.
|
||||||
// Manticore 25+ accepts exactly 3 arguments; options-as-extra-args were
|
// Manticore 25+ supports SNIPPET() as a SELECT expression; CALL SNIPPETS
|
||||||
// removed in this version. Default markers are already <b>/<b/>, which is
|
// returns a different packet type that the Go MySQL driver mishandles
|
||||||
// what we need. Manticore returns a single-column, single-row result.
|
// ("malformed packet"). Default markers are <b>/<b/>, no options needed.
|
||||||
row := idx.db.QueryRow(
|
q := fmt.Sprintf(`SELECT SNIPPET(?, ?) FROM %s LIMIT 1`, idx.table)
|
||||||
`CALL SNIPPETS(?, ?, ?)`,
|
row := idx.db.QueryRow(q, source, query)
|
||||||
source, idx.table, query,
|
|
||||||
)
|
|
||||||
var snippet string
|
var snippet string
|
||||||
if err := row.Scan(&snippet); err != nil {
|
if err := row.Scan(&snippet); err != nil {
|
||||||
return "", fmt.Errorf("call snippets %s: %w", idx.table, err)
|
return "", fmt.Errorf("call snippets %s: %w", idx.table, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user