mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-20 04:14:23 +01:00
implement terms query in evaluator
This commit is contained in:
parent
ffdddb3f68
commit
04673984f8
1 changed files with 8 additions and 1 deletions
|
@ -68,6 +68,13 @@ defmodule Search.Evaluator do
|
||||||
|> Enum.member?(query_val)
|
|> Enum.member?(query_val)
|
||||||
end
|
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_all: %{}}), do: true
|
||||||
def hits?(_doc, %{match_none: %{}}), do: false
|
def hits?(_doc, %{match_none: %{}}), do: false
|
||||||
def hits?(doc, %{function_score: %{query: query}}), do: hits?(doc, query)
|
def hits?(doc, %{function_score: %{query: query}}), do: hits?(doc, query)
|
||||||
|
|
Loading…
Reference in a new issue