File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,9 +45,6 @@ defmodule Oban.Web.JobQuery do
4545
4646 @ states Map . new ( Oban.Job . states ( ) , & { to_string ( & 1 ) , & 1 } )
4747
48- # Split terms using a positive lookahead that skips splitting within double quotes
49- @ split_pattern ~r/ \s +(?=([^\" ]*\" [^\" ]*\" )*[^\" ]*$)/
50-
5148 defguardp is_mysql ( conf ) when conf . engine == Oban.Engines.Dolphin
5249
5350 defguardp is_sqlite ( conf ) when conf . engine == Oban.Engines.Lite
@@ -191,7 +188,7 @@ defmodule Oban.Web.JobQuery do
191188
192189 def suggest ( terms , conf , opts \\ [ ] ) do
193190 terms
194- |> String . split ( @ split_pattern )
191+ |> String . split ( ~r / \s +(?=([^ \" ]* \" [^ \" ]* \" )*[^ \" ]*$) / )
195192 |> List . last ( )
196193 |> to_string ( )
197194 |> case do
Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ defmodule Oban.Web.QueueQuery do
2424
2525 # Searching
2626
27- @ split_pattern ~r/ \s +(?=([^\" ]*\" [^\" ]*\" )*[^\" ]*$)/
28-
2927 def filterable , do: ~w( modes nodes stats) a
3028
3129 def parse ( terms ) when is_binary ( terms ) do
@@ -34,7 +32,7 @@ defmodule Oban.Web.QueueQuery do
3432
3533 def suggest ( terms , conf , _opts \\ [ ] ) do
3634 terms
37- |> String . split ( @ split_pattern )
35+ |> String . split ( ~r / \s +(?=([^ \" ]* \" [^ \" ]* \" )*[^ \" ]*$) / )
3836 |> List . last ( )
3937 |> to_string ( )
4038 |> case do
Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ defmodule Oban.Web.Search do
33
44 # Helpers for the search toolbar
55
6- # Split terms using a positive lookahead that skips splitting within double quotes
7- @ split_pattern ~r/ \s +(?=([^\" ]*\" [^\" ]*\" )*[^\" ]*$)/
86 @ ignored_chars ~w( ; / \ ` ' = * ! ? # $ & + ^ | ~ < > ( \) { } [ ])
97
108 # Suggestion tuning
@@ -16,7 +14,7 @@ defmodule Oban.Web.Search do
1614 """
1715 def parse ( terms , parser ) when is_binary ( terms ) and is_function ( parser , 1 ) do
1816 terms
19- |> String . split ( @ split_pattern , trim: true )
17+ |> String . split ( ~r / \s +(?=([^ \" ]* \" [^ \" ]* \" )*[^ \" ]*$) / , trim: true )
2018 |> Map . new ( fn term ->
2119 term
2220 |> String . replace ( @ ignored_chars , "" )
You can’t perform that action at this time.
0 commit comments