Commit 79e44042 authored by Ivan Tashkinov's avatar Ivan Tashkinov
Browse files

[#477] User trigram index adjustment.

parent ed8f55ab
......@@ -744,7 +744,7 @@ defp trigram_search_subquery(query) do
select_merge: %{
search_rank:
fragment(
"similarity(?, ? || ' ' || coalesce(?, ''))",
"similarity(?, trim(? || ' ' || coalesce(?, '')))",
^query,
u.nickname,
u.name
......
defmodule Pleroma.Repo.Migrations.FixUserTrigramIndex do
use Ecto.Migration
def up do
drop_if_exists index(:users, [], name: :users_trigram_index)
create index(:users, ["(trim(nickname || ' ' || name)) gist_trgm_ops"], name: :users_trigram_index, using: :gist)
end
def down do
drop_if_exists index(:users, [], name: :users_trigram_index)
create index(:users, ["(nickname || name) gist_trgm_ops"], name: :users_trigram_index, using: :gist)
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment