Use inserted_at as sort in search.

This commit is contained in:
Roger Braun 2017-09-17 11:32:24 +02:00
parent 678dd4c8ec
commit b7b3e3f263

View file

@ -213,7 +213,7 @@ def search(user, %{"q" => query} = params) do
where: fragment("to_tsvector('english', ?->'object'->>'content') @@ plainto_tsquery('english', ?)", a.data, ^query), where: fragment("to_tsvector('english', ?->'object'->>'content') @@ plainto_tsquery('english', ?)", a.data, ^query),
limit: ^limit, limit: ^limit,
offset: ^offset, offset: ^offset,
order_by: [desc: :updated_at] # this one isn't indexed so psql won't take the wrong index. order_by: [desc: :inserted_at] # this one isn't indexed so psql won't take the wrong index.
activities = Repo.all(q) activities = Repo.all(q)
activities_to_statuses(activities, %{for: user}) activities_to_statuses(activities, %{for: user})