From 6d29f6bf49a2e640935b27685d2eb8585052452d Mon Sep 17 00:00:00 2001 From: Caio <117518+caiosba@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:27:41 -0300 Subject: [PATCH] Searching for fact-checks should match claim fields too. Now searching for fact-checks matches the claim fields "description" and "context". Fixes: CV2-5194. --- app/models/team.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/team.rb b/app/models/team.rb index 9facc8b32..02387976a 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -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