mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 22:27:59 +01:00
boost values must be non-negative since ES7 (bm25 forbids negative scores)
This commit is contained in:
parent
8c881da01c
commit
ba900f4ad6
1 changed files with 4 additions and 1 deletions
|
@ -107,9 +107,12 @@ defmodule Philomena.Search.Parser do
|
|||
|
||||
defp search_boost(parser, tokens) do
|
||||
case search_not(parser, tokens) do
|
||||
{:ok, {child, [{:boost, value} | r_tokens]}} ->
|
||||
{:ok, {child, [{:boost, value} | r_tokens]}} when value >= 0 ->
|
||||
{:ok, {%{function_score: %{query: child, boost: value}}, r_tokens}}
|
||||
|
||||
{:ok, {_child, [{:boost, _value} | _r_tokens]}} ->
|
||||
{:error, "Boost value must be non-negative."}
|
||||
|
||||
value ->
|
||||
value
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue