mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: add more quoting to avoid invalid terms
This commit is contained in:
parent
27b1ec2917
commit
b38a1309f7
2 changed files with 2 additions and 2 deletions
|
@ -481,7 +481,7 @@ class Search
|
|||
t.split(/[\)\(&']/)[0]
|
||||
end.compact!
|
||||
|
||||
query = Post.sanitize(all_terms.map {|t| "#{PG::Connection.escape_string(t)}:*"}.join(" #{joiner} "))
|
||||
query = Post.sanitize(all_terms.map {|t| "'#{PG::Connection.escape_string(t)}':*"}.join(" #{joiner} "))
|
||||
"TO_TSQUERY(#{locale || query_locale}, #{query})"
|
||||
end
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ describe Search do
|
|||
|
||||
it 'can parse complex strings using ts_query helper' do
|
||||
str = " grigio:babel deprecated? "
|
||||
str << "page page on Atmosphere](https://atmospherejs.com/grigio/babel)xxx: aaa'\"bbb"
|
||||
str << "page page on Atmosphere](https://atmospherejs.com/grigio/babel)xxx: aaa.js:222 aaa'\"bbb"
|
||||
|
||||
ts_query = Search.ts_query(str, "simple")
|
||||
Post.exec_sql("SELECT to_tsvector('bbb') @@ " << ts_query)
|
||||
|
|
Loading…
Reference in a new issue