Skip to content

Commit

Permalink
CV2-5129: apply PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Aug 28, 2024
1 parent 1c75d6b commit 5012694
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def filtered_explainers(filters = {})

# Filter by text
if filters[:text].to_s.size > 2
tsquery = Team.sanitize_sql_array(["to_tsquery(?)", filters[:text].split(/\s+/).map(&:strip).join(' & ')]) # FIXME: May not work for all languages
tsquery = Team.sanitize_sql_array(["websearch_to_tsquery(?)", filters[:text].split(/\s+/).map(&:strip).join(' & ')]) # FIXME: May not work for all languages
tsvector = "to_tsvector('simple', coalesce(title, '') || ' ' || coalesce(url, '') || coalesce(description, ''))"
query = query.where(Arel.sql("#{tsvector} @@ #{tsquery}"))
end
Expand Down Expand Up @@ -540,7 +540,7 @@ def filtered_fact_checks(filters = {})

# Filter by text
if filters[:text].to_s.size > 2
tsquery = Team.sanitize_sql_array(["to_tsquery(?)", filters[:text].split(/\s+/).map(&:strip).join(' & ')]) # FIXME: May not work for all languages
tsquery = Team.sanitize_sql_array(["websearch_to_tsquery(?)", filters[:text].split(/\s+/).map(&:strip).join(' & ')]) # FIXME: May not work for all languages
tsvector = "to_tsvector('simple', coalesce(title, '') || ' ' || coalesce(summary, '') || coalesce(url, ''))"
query = query.where(Arel.sql("#{tsvector} @@ #{tsquery}"))
end
Expand Down

0 comments on commit 5012694

Please sign in to comment.