This commit is contained in:
Liam P. White 2019-08-28 21:35:01 -04:00
parent 1a44260211
commit fdf53cb495
3 changed files with 24 additions and 13 deletions

View file

@ -25,7 +25,13 @@ defmodule Philomena.Elasticsearch do
def index_document(doc) do
data = unquote(definition).as_json(doc)
Elastix.Document.index(unquote(elastic_url), unquote(index_name), [unquote(doc_type)], data.id, data)
Elastix.Document.index(
unquote(elastic_url),
unquote(index_name),
[unquote(doc_type)],
data.id,
data
)
end
def reindex(ecto_query, batch_size \\ 1000) do

View file

@ -8,6 +8,7 @@ defmodule PhilomenaWeb.ImageController do
def index(conn, _params) do
query = conn.assigns[:compiled_filter]
images =
Image.search_records(
%{

View file

@ -25,7 +25,11 @@ defmodule PhilomenaWeb.SearchController do
render(conn, PhilomenaWeb.ImageView, "index.html", images: images, search_query: params["q"])
else
{:error, msg} ->
render(conn, PhilomenaWeb.ImageView, "index.html", images: [], error: msg, search_query: params["q"])
render(conn, PhilomenaWeb.ImageView, "index.html",
images: [],
error: msg,
search_query: params["q"]
)
end
end
end