MCPcopy
hub / github.com/dosco/graphjin / RenderTsQuery

Method RenderTsQuery

core/internal/dialect/sqlite.go:334–353  ·  view source on GitHub ↗
(ctx Context, ti sdata.DBTable, ex *qcode.Exp)

Source from the content-addressed store, hash-verified

332}
333
334func (d *SQLiteDialect) RenderTsQuery(ctx Context, ti sdata.DBTable, ex *qcode.Exp) {
335 // SQLite FTS5: For content-backed FTS, we need to query the FTS virtual table
336 // and match rowid with the main table's primary key.
337 // The FTS table name is typically the main table name suffixed with "_fts"
338 ftsTableName := ti.Name + "_fts"
339
340 ctx.WriteString(`(`)
341 ctx.ColWithTable(ti.Name, ti.PrimaryCol.Name)
342 ctx.WriteString(` IN (SELECT rowid FROM `)
343 ctx.Quote(ftsTableName)
344 ctx.WriteString(` WHERE `)
345 ctx.Quote(ftsTableName)
346 ctx.WriteString(` MATCH `)
347 if ex.Right.ValType == qcode.ValStr {
348 d.RenderLiteral(ctx, ex.Right.Val, ex.Right.ValType)
349 } else {
350 ctx.AddParam(Param{Name: ex.Right.Val, Type: "text"})
351 }
352 ctx.WriteString(`))`)
353}
354
355func (d *SQLiteDialect) RenderSearchRank(ctx Context, sel *qcode.Select, f qcode.Field) {
356 ctx.WriteString(`rank`) // FTS5 'rank' column

Callers

nothing calls this directly

Calls 5

RenderLiteralMethod · 0.95
WriteStringMethod · 0.65
ColWithTableMethod · 0.65
QuoteMethod · 0.65
AddParamMethod · 0.65

Tested by

no test coverage detected