fix for searches with two apostrophes
This commit is contained in:
parent
46c343a956
commit
f467d5e943
|
@ -105,9 +105,9 @@ class Search
|
|||
when :negated
|
||||
# TODO
|
||||
when :quoted
|
||||
terms.append '"' + strip_operators(value).gsub("'", "\\'") + '"'
|
||||
terms.append '"' + strip_operators(value).gsub("'", "\\\\'") + '"'
|
||||
when :term
|
||||
val = strip_operators(value).gsub("'", "\\'")
|
||||
val = strip_operators(value).gsub("'", "\\\\'")
|
||||
# if punctuation is replaced with a space, this would generate a terms search
|
||||
# AGAINST('+' in boolean mode)
|
||||
terms.append val if !val.empty?
|
||||
|
@ -178,9 +178,9 @@ class Search
|
|||
when :negated
|
||||
# TODO
|
||||
when :quoted
|
||||
terms.append '"' + strip_operators(value).gsub("'", "\\'") + '"'
|
||||
terms.append '"' + strip_operators(value).gsub("'", "\\\\'") + '"'
|
||||
when :term
|
||||
val = strip_operators(value).gsub("'", "\\'")
|
||||
val = strip_operators(value).gsub("'", "\\\\'")
|
||||
# if punctuation is replaced with a space, this would generate a terms search
|
||||
# AGAINST('+' in boolean mode)
|
||||
terms.append val if !val.empty?
|
||||
|
|
|
@ -85,6 +85,7 @@ describe Search do
|
|||
{what: "stories", q: "term", order: "newest#{esc}"},
|
||||
{what: "stories", q: "term", page: "2#{esc}"},
|
||||
{what: "stories#{esc}", q: "term"},
|
||||
{what: "stories", q: "term 'two apostrophes'"},
|
||||
# comments
|
||||
{what: "comments", q: "term#{esc}"},
|
||||
{what: "comments", q: "\"term#{esc}\""},
|
||||
|
|
Loading…
Reference in New Issue