Skip to content

Commit

Permalink
Searching for fact-checks should match claim fields too.
Browse files Browse the repository at this point in the history
Now searching for fact-checks matches the claim fields "description" and "context".

Fixes: CV2-5194.
  • Loading branch information
caiosba committed Sep 3, 2024
1 parent f6eb4c0 commit 6d29f6b
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 @@ -545,9 +545,9 @@ def filtered_fact_checks(filters = {})
end

def filter_by_keywords(query, filters, type = 'FactCheck')
tsquery = Team.sanitize_sql_array(["websearch_to_tsquery(?)", filters[:text]]) # FIXME: May not work for all languages
tsquery = Team.sanitize_sql_array(["websearch_to_tsquery(?)", filters[:text]])
if type == 'FactCheck'
tsvector = "to_tsvector('simple', coalesce(title, '') || ' ' || coalesce(summary, '') || coalesce(url, ''))"
tsvector = "to_tsvector('simple', coalesce(title, '') || ' ' || coalesce(summary, '') || coalesce(url, '') || coalesce(claim_descriptions.description, '') || coalesce(claim_descriptions.context, ''))"
else
tsvector = "to_tsvector('simple', coalesce(title, '') || ' ' || coalesce(description, '') || coalesce(url, ''))"
end
Expand Down

0 comments on commit 6d29f6b

Please sign in to comment.