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
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:
parent
0122512c2a
commit
6c01646ebf
3 changed files with 6 additions and 47 deletions
|
@ -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,
|
||||
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
|
||||
Pleroma.Config.get([Pleroma.Search.Elasticsearch.Cluster, :indexes, :activities])
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue