Skip to content

Commit

Permalink
Revert "Add full-text index to the search app"
Browse files Browse the repository at this point in the history
This reverts commit b4a30f6.
  • Loading branch information
bameda committed Aug 3, 2015
1 parent a251761 commit 84f5175
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 48 deletions.
41 changes: 0 additions & 41 deletions taiga/searches/migrations/0001_initial.py

This file was deleted.

Empty file.
16 changes: 9 additions & 7 deletions taiga/searches/services.py
Expand Up @@ -23,9 +23,10 @@

def search_user_stories(project, text):
model_cls = apps.get_model("userstories", "UserStory")
where_clause = ("to_tsvector('simple', coalesce(userstories_userstory.subject, '') || ' ' || "
"coalesce(userstories_userstory.ref) || ' ' || "
"coalesce(userstories_userstory.description, '')) @@ plainto_tsquery(%s)")
where_clause = ("to_tsvector(coalesce(userstories_userstory.subject) || ' ' || "
"coalesce(userstories_userstory.ref) || ' ' || "
"coalesce(userstories_userstory.description, '')) "
"@@ plainto_tsquery(%s)")

if text:
return (model_cls.objects.extra(where=[where_clause], params=[text])
Expand All @@ -36,7 +37,7 @@ def search_user_stories(project, text):

def search_tasks(project, text):
model_cls = apps.get_model("tasks", "Task")
where_clause = ("to_tsvector('simple', coalesce(tasks_task.subject, '') || ' ' || "
where_clause = ("to_tsvector(coalesce(tasks_task.subject, '') || ' ' || "
"coalesce(tasks_task.ref) || ' ' || "
"coalesce(tasks_task.description, '')) @@ plainto_tsquery(%s)")

Expand All @@ -49,7 +50,7 @@ def search_tasks(project, text):

def search_issues(project, text):
model_cls = apps.get_model("issues", "Issue")
where_clause = ("to_tsvector('simple', coalesce(issues_issue.subject) || ' ' || "
where_clause = ("to_tsvector(coalesce(issues_issue.subject) || ' ' || "
"coalesce(issues_issue.ref) || ' ' || "
"coalesce(issues_issue.description, '')) @@ plainto_tsquery(%s)")

Expand All @@ -62,8 +63,9 @@ def search_issues(project, text):

def search_wiki_pages(project, text):
model_cls = apps.get_model("wiki", "WikiPage")
where_clause = ("to_tsvector('simple', coalesce(wiki_wikipage.slug) || ' ' || "
"coalesce(wiki_wikipage.content, '')) @@ plainto_tsquery(%s)")
where_clause = ("to_tsvector(coalesce(wiki_wikipage.slug) || ' ' || "
"coalesce(wiki_wikipage.content, '')) "
"@@ plainto_tsquery(%s)")

if text:
return (model_cls.objects.extra(where=[where_clause], params=[text])
Expand Down

0 comments on commit 84f5175

Please sign in to comment.