load tags before body is processed

This commit is contained in:
byte[] 2019-12-26 18:58:52 -05:00
parent 54ed9b5c43
commit 1225aced41

View file

@ -24,11 +24,16 @@ defmodule PhilomenaWeb.ImageLoader do
queryable = Keyword.get(options, :queryable, Image |> preload(:tags))
constant_score = Keyword.get(options, :constant_score, true)
tags =
body
|> search_tag_names()
|> load_tags()
|> render_bodies(conn)
user = conn.assigns.current_user
filter = conn.assigns.compiled_filter
filters = create_filters(conn, user, filter)
body = maybe_constant_score(body, constant_score)
records =
Elasticsearch.search_records(
Image,
@ -45,12 +50,6 @@ defmodule PhilomenaWeb.ImageLoader do
queryable
)
tags =
body
|> search_tag_names()
|> load_tags()
|> render_bodies(conn)
{records, tags}
end