Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/search/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func search(ctx context.Context, conn *pgx.Conn, params SearchParams, cfg Rankin
}

const rankedSpeechSearchSQL = `
-- Keep headline options explicit; do not pass empty selectors to ts_headline.
WITH query AS (
SELECT
plainto_tsquery('english', $1) AS english_query,
Expand Down
18 changes: 18 additions & 0 deletions backend/search/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,24 @@ func TestRankingConfigRejectsInvalidEnv(t *testing.T) {
}
}

func TestTsHeadlineOptionsHaveNoEmptySelectors(t *testing.T) {
for _, tc := range []struct {
name string
sql string
}{
{"ranked", rankedSpeechSearchSQL},
{"legacy", legacySpeechSearchSQL},
} {
t.Run(tc.name, func(t *testing.T) {
for _, token := range []string{"StartSel=", "StopSel="} {
if strings.Contains(tc.sql, token) {
t.Fatalf("%s SQL unexpectedly contains %q", tc.name, token)
}
}
})
}
}

func TestRankingSQLDocumentsRequiredComponents(t *testing.T) {
required := []string{
"ts_rank",
Expand Down
Loading