mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 16:16:34 +00:00
SearchBackend: Add create_index
This commit is contained in:
parent
c50f0f31f4
commit
1261c43a7a
3 changed files with 13 additions and 1 deletions
|
@ -8,6 +8,12 @@ defmodule Mix.Tasks.Pleroma.Search.Indexer do
|
||||||
|
|
||||||
alias Pleroma.Workers.SearchIndexingWorker
|
alias Pleroma.Workers.SearchIndexingWorker
|
||||||
|
|
||||||
|
def run(["create_index"]) do
|
||||||
|
Application.ensure_all_started(:pleroma)
|
||||||
|
|
||||||
|
Pleroma.Config.get([Pleroma.Search, :module]).create_index()
|
||||||
|
end
|
||||||
|
|
||||||
def run(["index" | options]) do
|
def run(["index" | options]) do
|
||||||
{options, [], []} =
|
{options, [], []} =
|
||||||
OptionParser.parse(
|
OptionParser.parse(
|
||||||
|
|
|
@ -8,7 +8,8 @@ defmodule Pleroma.Search.QdrantSearch do
|
||||||
|
|
||||||
import Pleroma.Search.Meilisearch, only: [object_to_search_data: 1]
|
import Pleroma.Search.Meilisearch, only: [object_to_search_data: 1]
|
||||||
|
|
||||||
def initialize_index() do
|
@impl true
|
||||||
|
def create_index() do
|
||||||
payload = Pleroma.Config.get([Pleroma.Search.QdrantSearch, :qdrant_index_configuration])
|
payload = Pleroma.Config.get([Pleroma.Search.QdrantSearch, :qdrant_index_configuration])
|
||||||
QdrantClient.put("/collections/posts", payload)
|
QdrantClient.put("/collections/posts", payload)
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,4 +21,9 @@ defmodule Pleroma.Search.SearchBackend do
|
||||||
from index.
|
from index.
|
||||||
"""
|
"""
|
||||||
@callback remove_from_index(object :: Pleroma.Object.t()) :: :ok | {:error, any()}
|
@callback remove_from_index(object :: Pleroma.Object.t()) :: :ok | {:error, any()}
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Create the index
|
||||||
|
"""
|
||||||
|
@callback create_index() :: :ok | {:error, any()}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue