aboutsummaryrefslogtreecommitdiffstats
path: root/db/schema.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.sql
parent21efead606530cb754bb7b54586dbb8c1a1502ca (diff)
Add database index for user full text search.
Diffstat (limited to 'db/schema.sql')
-rw-r--r--db/schema.sql6
1 files changed, 6 insertions, 0 deletions
diff --git a/db/schema.sql b/db/schema.sql
index f198a287b..2c0cedb8d 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -41,6 +41,12 @@ create table users (
);
CREATE UNIQUE INDEX users_email_verified_unique ON users (email) WHERE email_verified;
CREATE UNIQUE INDEX users_phone_verified_unique ON users (phone) WHERE phone_verified;
+create index users_fulltext_idx on users USING GIN(
+ to_tsvector(
+ 'english',
+ translate(id || ' ' || coalesce(name,'') || ' ' || coalesce(email,'') || ' ' || coalesce(phone,''), '@.', ' ')
+ )
+);
-- Record details of reporting bodies, including open311 configuration details
create table body (