mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 12:08:00 +01:00
Fix range function clauses
This commit is contained in:
parent
f73befb439
commit
516f4a98fd
1 changed files with 12 additions and 0 deletions
|
@ -361,6 +361,9 @@ defmodule PhilomenaQuery.Parse.Parser do
|
|||
{%{wildcard: %{field(parser, field_name) => normalize_value(parser, field_name, value)}},
|
||||
[]}}
|
||||
|
||||
defp field_type(_parser, [{LiteralParser, field_name}, _range, _value]),
|
||||
do: {:error, "range specified for " <> field_name}
|
||||
|
||||
defp field_type(parser, [{NgramParser, field_name}, range: :eq, literal: value]),
|
||||
do:
|
||||
{:ok,
|
||||
|
@ -384,12 +387,21 @@ defmodule PhilomenaQuery.Parse.Parser do
|
|||
{%{wildcard: %{field(parser, field_name) => normalize_value(parser, field_name, value)}},
|
||||
[]}}
|
||||
|
||||
defp field_type(_parser, [{NgramParser, field_name}, _range, _value]),
|
||||
do: {:error, "range specified for " <> field_name}
|
||||
|
||||
defp field_type(parser, [{BoolParser, field_name}, range: :eq, bool: value]),
|
||||
do: {:ok, {%{term: %{field(parser, field_name) => value}}, []}}
|
||||
|
||||
defp field_type(_parser, [{BoolParser, field_name}, _range, _value]),
|
||||
do: {:error, "range specified for " <> field_name}
|
||||
|
||||
defp field_type(parser, [{IpParser, field_name}, range: :eq, ip: value]),
|
||||
do: {:ok, {%{term: %{field(parser, field_name) => value}}, []}}
|
||||
|
||||
defp field_type(_parser, [{IpParser, field_name}, _range, _value]),
|
||||
do: {:error, "range specified for " <> field_name}
|
||||
|
||||
# Types which do support ranges
|
||||
|
||||
defp field_type(parser, [{IntParser, field_name}, range: :eq, int: value]),
|
||||
|
|
Loading…
Reference in a new issue