remove broken task
Some checks failed
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/release Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/push/test Pipeline failed

This commit is contained in:
sadposter 2022-06-30 19:43:30 +01:00
parent 0122512c2a
commit 6c01646ebf
3 changed files with 6 additions and 47 deletions

View file

@ -58,7 +58,7 @@ def start_pleroma do
[name: Pleroma.MajicPool, pool_size: Pleroma.Config.get([:majic_pool, :size], 2)]}
] ++
http_children(adapter) ++
elasticsearch_children()
elasticsearch_children()
cachex_children = Enum.map(@cachex_children, &Pleroma.Application.build_cachex(&1, []))

View file

@ -5,48 +5,16 @@
defmodule Mix.Tasks.Pleroma.Search do
use Mix.Task
import Mix.Pleroma
import Ecto.Query
alias Pleroma.Activity
alias Pleroma.Pagination
alias Pleroma.User
alias Pleroma.Hashtag
@shortdoc "Manages elasticsearch"
def run(["import", "activities" | _rest]) do
start_pleroma()
Elasticsearch.Index.Bulk.upload(Pleroma.Search.Elasticsearch.Cluster,
"activities",
Pleroma.Config.get([Pleroma.Search.Elasticsearch.Cluster, :indexes, :activities]))
#from(a in Activity, where: not ilike(a.actor, "%/relay"))
#|> where([a], fragment("(? ->> 'type'::text) = 'Create'", a.data))
#|> Activity.with_preloaded_object()
#|> Activity.with_preloaded_user_actor()
#|> get_all(:activities)
end
defp get_all(query, index, max_id \\ nil) do
params = %{limit: 1000}
params =
if max_id == nil do
params
else
Map.put(params, :max_id, max_id)
end
res =
query
|> Pagination.fetch_paginated(params)
if res == [] do
:ok
else
res
|> Enum.map(fn x -> Pleroma.Search.Elasticsearch.add_to_index(x) end)
get_all(query, index, List.last(res).id)
end
Elasticsearch.Index.Bulk.upload(
Pleroma.Search.Elasticsearch.Cluster,
"activities",
Pleroma.Config.get([Pleroma.Search.Elasticsearch.Cluster, :indexes, :activities])
)
end
end

View file

@ -1,9 +0,0 @@
defmodule Mix.Tasks.Pleroma.Search.Elasticsearch do
alias Mix.Tasks.Elasticsearch.Build
import Mix.Pleroma
def run(["index" | args]) do
start_pleroma()
Build.run(args)
end
end