mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 10:09:02 +00:00
[#477] User trigram index adjustment.
This commit is contained in:
parent
ed8f55ab8e
commit
79e44042bc
|
@ -744,7 +744,7 @@ defmodule Pleroma.User do
|
||||||
select_merge: %{
|
select_merge: %{
|
||||||
search_rank:
|
search_rank:
|
||||||
fragment(
|
fragment(
|
||||||
"similarity(?, ? || ' ' || coalesce(?, ''))",
|
"similarity(?, trim(? || ' ' || coalesce(?, '')))",
|
||||||
^query,
|
^query,
|
||||||
u.nickname,
|
u.nickname,
|
||||||
u.name
|
u.name
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
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
|
Loading…
Reference in a new issue