@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)
}
}
}