Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(engine/dolphin): implement MATCH_AGAINST conversion in SQL AST (#…
…1192, #3091)

* add conversion logic for MATCH_AGAINST statements
* create type casting for search terms to 'text'
* construct A_Expr for MATCH_AGAINST operation
  • Loading branch information
Vladimir Kochergin committed Aug 20, 2025
commit 0098435f8338d7a9838bb13426c0e9dfac6c5248
25 changes: 24 additions & 1 deletion internal/engine/dolphin/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,30 @@ func (c *cc) convertLockTablesStmt(n *pcast.LockTablesStmt) ast.Node {
}

func (c *cc) convertMatchAgainst(n *pcast.MatchAgainst) ast.Node {
return todo(n)
searchTerm := c.convert(n.Against)

stringSearchTerm := &ast.TypeCast{
Arg: searchTerm,
TypeName: &ast.TypeName{
Name: "text", // Use 'text' type which maps to string in Go
},
Location: n.OriginTextPosition(),
}

matchOperation := &ast.A_Const{
Val: &ast.String{Str: "MATCH_AGAINST"},
}

return &ast.A_Expr{
Name: &ast.List{
Items: []ast.Node{
&ast.String{Str: "AGAINST"},
},
},
Lexpr: matchOperation,
Rexpr: stringSearchTerm,
Location: n.OriginTextPosition(),
}
}

func (c *cc) convertMaxValueExpr(n *pcast.MaxValueExpr) ast.Node {
Expand Down
Loading