From: sadposter Date: Tue, 14 Dec 2021 14:01:09 +0000 (+0000) Subject: Merge branch 'develop' of gitssh.ihatebeinga.live:IHBAGang/pleroma into develop X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=8f78cb3050c12b45e608b681a6bf406c76f90031;p=akkoma Merge branch 'develop' of gitssh.ihatebeinga.live:IHBAGang/pleroma into develop --- 8f78cb3050c12b45e608b681a6bf406c76f90031 diff --cc lib/pleroma/search/elasticsearch.ex index 3815ef766,e770fe536..c897a2ace --- a/lib/pleroma/search/elasticsearch.ex +++ b/lib/pleroma/search/elasticsearch.ex @@@ -2,36 -2,36 +2,51 @@@ defmodule Pleroma.Search.Elasticsearch @behaviour Pleroma.Search alias Pleroma.Web.MastodonAPI.StatusView + alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.ActivityPub.Visibility + alias Pleroma.Search.Elasticsearch.Parsers + alias Pleroma.Web.Endpoint - defp to_es(term) when is_binary(term) do + defp es_query(:activity, query) do %{ - match: %{ - content: %{ - query: term, - operator: "AND" ++ size: 500, ++ terminate_after: 500, ++ timeout: "10s", ++ sort: [ ++ %{"_timestamp" => "desc"} ++ ], + query: %{ + bool: %{ + must: Parsers.Activity.parse(query) } } } end - defp to_es({:quoted, term}), do: to_es(term) - - defp to_es({:filter, ["hashtag", query]}) do + defp es_query(:user, query) do %{ - term: %{ - hashtags: %{ - value: query ++ size: 50, ++ terminate_after: 50, ++ timeout: "10s", ++ sort: [ ++ %{"_timestamp" => "desc"} ++ ], + query: %{ + bool: %{ + must: Parsers.User.parse(query) } } } end - defp to_es({:filter, [field, query]}) do + defp es_query(:hashtag, query) do %{ - term: %{ - field => %{ - value: query ++ size: 50, ++ terminate_after: 50, ++ timeout: "10s", + query: %{ + bool: %{ + must: Parsers.Hashtag.parse(query) } } }