FIX: Specify config when generating tsquery using ts_headline.

This commit is contained in:
Guo Xiang Tan 2020-08-07 10:19:21 +08:00
parent fb9c2e5f89
commit ab2b6f8dea
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20

View File

@ -1162,7 +1162,7 @@ class Search
default_scope
.joins("INNER JOIN post_search_data pd ON pd.post_id = posts.id")
.select(
"TS_HEADLINE(#{default_ts_config}, pd.raw_data, PLAINTO_TSQUERY('#{@term.present? ? PG::Connection.escape_string(@term) : nil}'), 'ShortWord=0, MaxFragments=1, MinWords=50, MaxWords=51, StartSel=''<span class=\"#{HIGHLIGHT_CSS_CLASS}\">'', StopSel=''</span>''') AS headline",
"TS_HEADLINE(#{default_ts_config}, pd.raw_data, PLAINTO_TSQUERY(#{default_ts_config}, '#{@term.present? ? PG::Connection.escape_string(@term) : nil}'), 'ShortWord=0, MaxFragments=1, MinWords=50, MaxWords=51, StartSel=''<span class=\"#{HIGHLIGHT_CSS_CLASS}\">'', StopSel=''</span>''') AS headline",
default_scope.arel.projections
)
else