From 4257f6d5a0cf10d8f12470db8859d693238b6b9d Mon Sep 17 00:00:00 2001 From: Riccardo Coccioli Date: Tue, 9 Feb 2016 14:05:15 +0100 Subject: [PATCH] Search also into tags fields Changed the search queries to search also into the tags fields. Fixes #276 --- AUTHORS.rst | 4 +--- taiga/searches/services.py | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 5be3cfd6..c7aff636 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -20,10 +20,7 @@ answer newbie questions, and generally made taiga that much better: - Andrea Stagi - Andrés Moya - Andrey Alekseenko -<<<<<<< HEAD -======= - Brett Profitt ->>>>>>> master - Bruno Clermont - Chris Wilson - David Burke @@ -33,6 +30,7 @@ answer newbie questions, and generally made taiga that much better: - Julien Palard - luyikei - Motius GmbH +- Riccardo Coccioli - Ricky Posner - Yamila Moreno - Yaser Alraddadi diff --git a/taiga/searches/services.py b/taiga/searches/services.py index 4dcda86f..5e04518a 100644 --- a/taiga/searches/services.py +++ b/taiga/searches/services.py @@ -28,6 +28,7 @@ def search_user_stories(project, text): model_cls = apps.get_model("userstories", "UserStory") where_clause = ("to_tsvector('english_nostop', coalesce(userstories_userstory.subject) || ' ' || " "coalesce(userstories_userstory.ref) || ' ' || " + "coalesce(array_to_string(userstories_userstory.tags, ' '), '') || ' ' || " "coalesce(userstories_userstory.description, '')) " "@@ to_tsquery('english_nostop', %s)") @@ -44,6 +45,7 @@ def search_tasks(project, text): model_cls = apps.get_model("tasks", "Task") where_clause = ("to_tsvector('english_nostop', coalesce(tasks_task.subject, '') || ' ' || " "coalesce(tasks_task.ref) || ' ' || " + "coalesce(array_to_string(tasks_task.tags, ' '), '') || ' ' || " "coalesce(tasks_task.description, '')) @@ to_tsquery('english_nostop', %s)") if text: @@ -57,6 +59,7 @@ def search_issues(project, text): model_cls = apps.get_model("issues", "Issue") where_clause = ("to_tsvector('english_nostop', coalesce(issues_issue.subject) || ' ' || " "coalesce(issues_issue.ref) || ' ' || " + "coalesce(array_to_string(issues_issue.tags, ' '), '') || ' ' || " "coalesce(issues_issue.description, '')) @@ to_tsquery('english_nostop', %s)") if text: