[#477] Added FTS index for users. Fixed failing test.

This commit is contained in:
Ivan Tashkinov 2019-01-15 12:04:54 +03:00
commit fc965f982c
2 changed files with 22 additions and 5 deletions

View file

@ -0,0 +1,17 @@
defmodule Pleroma.Repo.Migrations.CreateUserFtsIndex do
use Ecto.Migration
def change do
create index(
:users,
[
"""
(setweight(to_tsvector('simple', regexp_replace(nickname, '\\W', ' ', 'g')), 'A') ||
setweight(to_tsvector('simple', regexp_replace(coalesce(name, ''), '\\W', ' ', 'g')), 'B'))
"""
],
name: :users_fts_index,
using: :gin
)
end
end