From 7f30218b82a71eae20a69317cfed31e65a97e459 Mon Sep 17 00:00:00 2001 From: sadposter Date: Tue, 14 Dec 2021 14:48:24 +0000 Subject: [PATCH] extra cool --- lib/pleroma/elasticsearch/store.ex | 4 +++- lib/pleroma/search/elasticsearch.ex | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/elasticsearch/store.ex b/lib/pleroma/elasticsearch/store.ex index 2f8375c48..93501a2fb 100644 --- a/lib/pleroma/elasticsearch/store.ex +++ b/lib/pleroma/elasticsearch/store.ex @@ -120,7 +120,7 @@ def bulk_post(data, :users) do ) end - def bulk_post(data, :hashtags) do + def bulk_post([] = data, :hashtags) do d = data |> Enum.map(fn d -> @@ -139,6 +139,8 @@ def bulk_post(data, :hashtags) do ) end + def bulk_post(_, :hashtags), do: {:ok, nil} + def search(:raw, index, type, q) do with {:ok, raw_results} <- Elastix.Search.search(url(), index, [type], q) do results = diff --git a/lib/pleroma/search/elasticsearch.ex b/lib/pleroma/search/elasticsearch.ex index 00ae6b3dc..145bdec7b 100644 --- a/lib/pleroma/search/elasticsearch.ex +++ b/lib/pleroma/search/elasticsearch.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Search.Elasticsearch do alias Pleroma.Search.Elasticsearch.Parsers alias Pleroma.Web.Endpoint - defp es_query(:activity, query) do + def es_query(:activity, query) do %{ size: 50, terminate_after: 50, @@ -23,7 +23,7 @@ defp es_query(:activity, query) do } end - defp es_query(:user, query) do + def es_query(:user, query) do %{ size: 50, terminate_after: 50, @@ -36,7 +36,7 @@ defp es_query(:user, query) do } end - defp es_query(:hashtag, query) do + def es_query(:hashtag, query) do %{ size: 50, terminate_after: 50,