Skip to content

Commit 9ca8720

Browse files
kyleconroyclaude
andcommitted
Add SEARCH PROPERTY LIST support for fulltext index statements
- Add SearchPropertyListFullTextIndexOption AST type - Add SetSearchPropertyListAlterFullTextIndexAction for ALTER FULLTEXT INDEX - Update parser to handle SEARCH PROPERTY LIST option in CREATE/ALTER - Fix parseAddAlterFullTextIndexAction to handle STATISTICAL_SEMANTICS - Convert UTF-16 test file to UTF-8 for Baselines110_FulltextIndexStatementTests110 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f5c28ac commit 9ca8720

7 files changed

Lines changed: 109 additions & 6 deletions

File tree

ast/alter_simple_statements.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,25 @@ type ChangeTrackingFullTextIndexOption struct {
368368
func (*ChangeTrackingFullTextIndexOption) node() {}
369369
func (*ChangeTrackingFullTextIndexOption) fullTextIndexOption() {}
370370

371+
// SearchPropertyListFullTextIndexOption represents a SEARCH PROPERTY LIST option for fulltext index
372+
type SearchPropertyListFullTextIndexOption struct {
373+
IsOff bool `json:"IsOff"`
374+
PropertyListName *Identifier `json:"PropertyListName,omitempty"`
375+
OptionKind string `json:"OptionKind,omitempty"` // "SearchPropertyList"
376+
}
377+
378+
func (*SearchPropertyListFullTextIndexOption) node() {}
379+
func (*SearchPropertyListFullTextIndexOption) fullTextIndexOption() {}
380+
381+
// SetSearchPropertyListAlterFullTextIndexAction represents a SET SEARCH PROPERTY LIST action for fulltext index
382+
type SetSearchPropertyListAlterFullTextIndexAction struct {
383+
SearchPropertyListOption *SearchPropertyListFullTextIndexOption `json:"SearchPropertyListOption,omitempty"`
384+
WithNoPopulation bool `json:"WithNoPopulation"`
385+
}
386+
387+
func (*SetSearchPropertyListAlterFullTextIndexAction) node() {}
388+
func (*SetSearchPropertyListAlterFullTextIndexAction) alterFullTextIndexAction() {}
389+
371390
// FullTextCatalogAndFileGroup represents catalog and filegroup for fulltext index
372391
type FullTextCatalogAndFileGroup struct {
373392
CatalogName *Identifier `json:"CatalogName,omitempty"`

parser/marshal.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18319,6 +18319,15 @@ func alterFullTextIndexActionToJSON(a ast.AlterFullTextIndexActionOption) jsonNo
1831918319
node["StopListOption"] = stopListFullTextIndexOptionToJSON(action.StopListOption)
1832018320
}
1832118321
return node
18322+
case *ast.SetSearchPropertyListAlterFullTextIndexAction:
18323+
node := jsonNode{
18324+
"$type": "SetSearchPropertyListAlterFullTextIndexAction",
18325+
"WithNoPopulation": action.WithNoPopulation,
18326+
}
18327+
if action.SearchPropertyListOption != nil {
18328+
node["SearchPropertyListOption"] = searchPropertyListFullTextIndexOptionToJSON(action.SearchPropertyListOption)
18329+
}
18330+
return node
1832218331
case *ast.AlterColumnAlterFullTextIndexAction:
1832318332
node := jsonNode{
1832418333
"$type": "AlterColumnAlterFullTextIndexAction",
@@ -18344,6 +18353,18 @@ func stopListFullTextIndexOptionToJSON(opt *ast.StopListFullTextIndexOption) jso
1834418353
return node
1834518354
}
1834618355

18356+
func searchPropertyListFullTextIndexOptionToJSON(opt *ast.SearchPropertyListFullTextIndexOption) jsonNode {
18357+
node := jsonNode{
18358+
"$type": "SearchPropertyListFullTextIndexOption",
18359+
"IsOff": opt.IsOff,
18360+
"OptionKind": opt.OptionKind,
18361+
}
18362+
if opt.PropertyListName != nil {
18363+
node["PropertyListName"] = identifierToJSON(opt.PropertyListName)
18364+
}
18365+
return node
18366+
}
18367+
1834718368
func fullTextIndexColumnToJSON(col *ast.FullTextIndexColumn) jsonNode {
1834818369
node := jsonNode{
1834918370
"$type": "FullTextIndexColumn",
@@ -19399,6 +19420,8 @@ func fullTextIndexOptionToJSON(opt ast.FullTextIndexOption) jsonNode {
1939919420
}
1940019421
case *ast.StopListFullTextIndexOption:
1940119422
return stopListFullTextIndexOptionToJSON(o)
19423+
case *ast.SearchPropertyListFullTextIndexOption:
19424+
return searchPropertyListFullTextIndexOptionToJSON(o)
1940219425
}
1940319426
return nil
1940419427
}

parser/parse_ddl.go

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9375,6 +9375,43 @@ func (p *Parser) tryParseAlterFullTextIndexAction() ast.AlterFullTextIndexAction
93759375
}
93769376
}
93779377
return action
9378+
} else if strings.ToUpper(p.curTok.Literal) == "SEARCH" {
9379+
// Parse SET SEARCH PROPERTY LIST OFF | name [WITH NO POPULATION]
9380+
p.nextToken() // consume SEARCH
9381+
if strings.ToUpper(p.curTok.Literal) == "PROPERTY" {
9382+
p.nextToken() // consume PROPERTY
9383+
}
9384+
if strings.ToUpper(p.curTok.Literal) == "LIST" {
9385+
p.nextToken() // consume LIST
9386+
}
9387+
// Handle optional = sign
9388+
if p.curTok.Type == TokenEquals {
9389+
p.nextToken() // consume =
9390+
}
9391+
action := &ast.SetSearchPropertyListAlterFullTextIndexAction{
9392+
SearchPropertyListOption: &ast.SearchPropertyListFullTextIndexOption{
9393+
OptionKind: "SearchPropertyList",
9394+
},
9395+
}
9396+
if strings.ToUpper(p.curTok.Literal) == "OFF" {
9397+
action.SearchPropertyListOption.IsOff = true
9398+
p.nextToken()
9399+
} else {
9400+
action.SearchPropertyListOption.IsOff = false
9401+
action.SearchPropertyListOption.PropertyListName = p.parseIdentifier()
9402+
}
9403+
// Check for WITH NO POPULATION
9404+
if p.curTok.Type == TokenWith {
9405+
p.nextToken() // consume WITH
9406+
if strings.ToUpper(p.curTok.Literal) == "NO" {
9407+
p.nextToken() // consume NO
9408+
if strings.ToUpper(p.curTok.Literal) == "POPULATION" {
9409+
p.nextToken() // consume POPULATION
9410+
action.WithNoPopulation = true
9411+
}
9412+
}
9413+
}
9414+
return action
93789415
}
93799416
return nil
93809417
case "START":
@@ -9512,7 +9549,11 @@ func (p *Parser) parseAddAlterFullTextIndexAction() (*ast.AddAlterFullTextIndexA
95129549
}
95139550
}
95149551

9515-
// StatisticalSemantics defaults to false
9552+
// Check for STATISTICAL_SEMANTICS
9553+
if strings.ToUpper(p.curTok.Literal) == "STATISTICAL_SEMANTICS" {
9554+
p.nextToken() // consume STATISTICAL_SEMANTICS
9555+
col.StatisticalSemantics = true
9556+
}
95169557

95179558
action.Columns = append(action.Columns, col)
95189559

parser/parse_statements.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13511,6 +13511,30 @@ func (p *Parser) parseCreateFulltextStatement() (ast.Statement, error) {
1351113511
opt.StopListName = p.parseIdentifier()
1351213512
}
1351313513
stmt.Options = append(stmt.Options, opt)
13514+
} else if optLit == "SEARCH" {
13515+
p.nextToken() // consume SEARCH
13516+
// Expect PROPERTY LIST
13517+
if strings.ToUpper(p.curTok.Literal) == "PROPERTY" {
13518+
p.nextToken() // consume PROPERTY
13519+
}
13520+
if strings.ToUpper(p.curTok.Literal) == "LIST" {
13521+
p.nextToken() // consume LIST
13522+
}
13523+
// Handle optional = sign
13524+
if p.curTok.Type == TokenEquals {
13525+
p.nextToken() // consume =
13526+
}
13527+
opt := &ast.SearchPropertyListFullTextIndexOption{
13528+
OptionKind: "SearchPropertyList",
13529+
}
13530+
if strings.ToUpper(p.curTok.Literal) == "OFF" {
13531+
opt.IsOff = true
13532+
p.nextToken()
13533+
} else {
13534+
opt.IsOff = false
13535+
opt.PropertyListName = p.parseIdentifier()
13536+
}
13537+
stmt.Options = append(stmt.Options, opt)
1351413538
} else if optLit == "NO" {
1351513539
p.nextToken() // consume NO
1351613540
if strings.ToUpper(p.curTok.Literal) == "POPULATION" {
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
{
2-
"todo": true,
3-
"skip_reason": "UTF-16 encoded query.sql file"
4-
}
1+
{}
Binary file not shown.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"todo": true,
32
"skip_reason": "UTF-16 encoded query.sql file"
43
}

0 commit comments

Comments
 (0)