Extract host from ap_id, add index

This commit is contained in:
eal 2018-06-06 21:13:40 +03:00
parent 9075b6d25b
commit 29c9c8d93b
2 changed files with 9 additions and 1 deletions

View file

@ -445,7 +445,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
activity in query,
where: fragment("not (? = ANY(?))", activity.actor, ^blocks),
where: fragment("not (?->'to' \\?| ?)", activity.data, ^blocks),
where: fragment("not (? ~ ANY(?))", activity.actor, ^domain_blocks)
where: fragment("not (split_part(?, '/', 3) = ANY(?))", activity.actor, ^domain_blocks)
)
end

View file

@ -0,0 +1,8 @@
defmodule Pleroma.Repo.Migrations.CreateApidHostExtractionIndex do
use Ecto.Migration
@disable_ddl_transaction true
def change do
create index(:activities, ["(split_part(actor, '/', 3))"], concurrently: true, name: :activities_hosts)
end
end