aboutsummaryrefslogtreecommitdiffstats
path: root/db/schema_0074-add-users-full-text-search-index.sql
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-08-05 15:56:10 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-08-06 20:28:57 +0100
commit7af4f2cc87cd6ff55501bb2856193a03fe72158c (patch)
treee2c1f396bb4a34220379b94d9e25d4671f29b052 /db/schema_0074-add-users-full-text-search-index.sql
parent21efead606530cb754bb7b54586dbb8c1a1502ca (diff)
Add database index for user full text search.
Diffstat (limited to 'db/schema_0074-add-users-full-text-search-index.sql')
-rw-r--r--db/schema_0074-add-users-full-text-search-index.sql6
1 files changed, 6 insertions, 0 deletions
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,''), '@.', ' ')
+ )
+);