logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

20190115085500_create_user_fts_index.exs (630B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.CreateUserFtsIndex do
  5. use Ecto.Migration
  6. def change do
  7. create_if_not_exists(
  8. index(
  9. :users,
  10. [
  11. """
  12. (setweight(to_tsvector('simple', regexp_replace(nickname, '\\W', ' ', 'g')), 'A') ||
  13. setweight(to_tsvector('simple', regexp_replace(coalesce(name, ''), '\\W', ' ', 'g')), 'B'))
  14. """
  15. ],
  16. name: :users_fts_index,
  17. using: :gin
  18. )
  19. )
  20. end
  21. end