diff --git a/lib/search/evaluator.ex b/lib/search/evaluator.ex index cb3f2ab7..5fabc406 100644 --- a/lib/search/evaluator.ex +++ b/lib/search/evaluator.ex @@ -68,6 +68,13 @@ defmodule Search.Evaluator do |> Enum.member?(query_val) end + def hits?(doc, %{terms: terms_query}) do + [{term, query_vals}] = Enum.to_list(terms_query) + + wrap(doc[atomify(term)]) + |> Enum.any?(&Enum.member?(query_vals, &1)) + end + def hits?(_doc, %{match_all: %{}}), do: true def hits?(_doc, %{match_none: %{}}), do: false def hits?(doc, %{function_score: %{query: query}}), do: hits?(doc, query) @@ -139,4 +146,4 @@ defmodule Search.Evaluator do Regex.compile!("\\A#{re}\\z", "im") end -end \ No newline at end of file +end