From 7af4f2cc87cd6ff55501bb2856193a03fe72158c Mon Sep 17 00:00:00 2001
From: M Somerville <matthew-github@dracos.co.uk>
Date: Wed, 5 Aug 2020 15:56:10 +0100
Subject: Add database index for user full text search.

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

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

diff --git a/db/schema_0074-add-users-full-text-search-index.sql b/db/schema_0074-add-users-full-text-search-index.sql
new file mode 100644
index 000000000..dc743bd47
--- /dev/null
+++ b/db/schema_0074-add-users-full-text-search-index.sql
@@ -0,0 +1,6 @@
+CREATE INDEX CONCURRENTLY users_fulltext_idx on users USING GIN(
+    to_tsvector(
+        'DB_FULL_TEXT_SEARCH_CONFIG',
+        translate(id || ' ' || coalesce(name,'') || ' ' || coalesce(email,'') || ' ' || coalesce(phone,''), '@.', '  ')
+    )
+);
-- 
cgit v1.2.3

