mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 22:27:59 +01:00
normalize search string in filter compilation
This commit is contained in:
parent
ae489ef6ea
commit
4915fb5044
2 changed files with 6 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
defmodule PhilomenaWeb.Plugs.ImageFilter do
|
||||
import Plug.Conn
|
||||
import Search.String
|
||||
|
||||
alias Philomena.Images.Query
|
||||
alias Pow.Plug
|
||||
|
@ -13,7 +14,7 @@ defmodule PhilomenaWeb.Plugs.ImageFilter do
|
|||
filter = conn.assigns[:current_filter]
|
||||
|
||||
tag_exclusion = %{terms: %{tag_ids: filter.hidden_tag_ids}}
|
||||
{:ok, query_exclusion} = Query.compile(user, filter.hidden_complex_str)
|
||||
{:ok, query_exclusion} = Query.compile(user, normalize(filter.hidden_complex_str))
|
||||
|
||||
query = %{
|
||||
bool: %{
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
defmodule Search.String do
|
||||
def normalize(nil) do
|
||||
""
|
||||
end
|
||||
|
||||
def normalize(str) do
|
||||
str
|
||||
|> String.replace("\r", "")
|
||||
|
|
Loading…
Reference in a new issue