diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-07-29 09:03:56 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-07-31 12:33:38 +0100 |
commit | bd42d6a1fcb6c8e6d89413e0ee22617625d95bad (patch) | |
tree | 2bdbeff779e44d14aa2409f9660ab3c91c9a8377 /db/schema_0073-add-full-text-search-index.sql | |
parent | 34dd7c253d337ea922049390dc6ba44b8686e516 (diff) |
Add database index for full text search.
Diffstat (limited to 'db/schema_0073-add-full-text-search-index.sql')
-rw-r--r-- | db/schema_0073-add-full-text-search-index.sql | 13 |
1 files changed, 13 insertions, 0 deletions
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, '/.', ' ') + ) +); |