From bd42d6a1fcb6c8e6d89413e0ee22617625d95bad Mon Sep 17 00:00:00 2001
From: Matthew Somerville <matthew@mysociety.org>
Date: Wed, 29 Jul 2020 09:03:56 +0100
Subject: Add database index for full text search.

---
 db/schema_0073-add-full-text-search-index.sql | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 db/schema_0073-add-full-text-search-index.sql

(limited to 'db/schema_0073-add-full-text-search-index.sql')

diff --git a/db/schema_0073-add-full-text-search-index.sql b/db/schema_0073-add-full-text-search-index.sql
new file mode 100644
index 000000000..9871386bd
--- /dev/null
+++ b/db/schema_0073-add-full-text-search-index.sql
@@ -0,0 +1,13 @@
+CREATE INDEX CONCURRENTLY problem_fulltext_idx ON problem USING GIN(
+    to_tsvector(
+        'DB_FULL_TEXT_SEARCH_CONFIG',
+        translate(id || ' ' || coalesce(external_id,'') || ' ' || coalesce(bodies_str,'') || ' ' || name || ' ' || title || ' ' || detail, '/.', '  ')
+    )
+);
+
+CREATE INDEX CONCURRENTLY comment_fulltext_idx on comment USING GIN(
+    to_tsvector(
+        'DB_FULL_TEXT_SEARCH_CONFIG',
+        translate(id || ' ' || problem_id || ' ' || coalesce(name,'') || ' ' || text, '/.', '  ')
+    )
+);
-- 
cgit v1.2.3

