From 1ef368c286cfe23194b94a3e44662c13233776f2 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Wed, 29 Apr 2020 22:44:03 -0400 Subject: [PATCH] prevent crash on gallery_id query in filter, fixes #99 --- lib/search/evaluator.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/search/evaluator.ex b/lib/search/evaluator.ex index ecd1d3bc..aa1f4fdc 100644 --- a/lib/search/evaluator.ex +++ b/lib/search/evaluator.ex @@ -64,6 +64,11 @@ defmodule Search.Evaluator do |> Enum.any?(&String.contains?(&1, query_val)) end + def hits?(doc, %{nested: _}) do + # No way to tell without a wildly expensive database query + false + end + def hits?(doc, %{term: term_query}) do [{term, query_val}] = Enum.to_list(term_query)