only return create objects for ES search #165
3 changed files with 4 additions and 3 deletions
|
@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
### Fixed
|
||||
- Compatibility with latest meilisearch
|
||||
- Resolution of nested mix tasks (i.e search.meilisearch) in OTP releases
|
||||
- Elasticsearch returning likes and repeats, displaying as posts
|
||||
|
||||
### Removed
|
||||
- Non-finch HTTP adapters. `:tesla, :adapter` is now highly recommended to be set to the default.
|
||||
|
|
|
@ -23,7 +23,7 @@ def es_query(:activity, query, offset, limit) do
|
|||
timeout: "5s",
|
||||
sort: [
|
||||
"_score",
|
||||
%{_timestamp: %{order: "desc", format: "basic_date_time"}}
|
||||
%{"_timestamp" => %{order: "desc", format: "basic_date_time"}}
|
||||
],
|
||||
query: %{
|
||||
bool: %{
|
||||
|
@ -65,7 +65,8 @@ def search(user, query, options) do
|
|||
:activities
|
||||
|> Pleroma.Search.Elasticsearch.Store.search(q)
|
||||
|> Enum.filter(fn x ->
|
||||
x.data["type"] == "Create" && x.object.data["type"] == "Note" && Visibility.visible_for_user?(x, user)
|
||||
x.data["type"] == "Create" && x.object.data["type"] == "Note" &&
|
||||
Visibility.visible_for_user?(x, user)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ def search(:activities, q) do
|
|||
results
|
||||
|> Enum.map(fn result -> result["_id"] end)
|
||||
|> Pleroma.Activity.all_by_ids_with_object()
|
||||
|> Enum.sort(&(&1.inserted_at >= &2.inserted_at))
|
||||
else
|
||||
e ->
|
||||
Logger.error(e)
|
||||
|
|
Loading…
Reference in a new issue