FIX: a search term containing '& could lead to errors

This also makes sure that the search term in front or after special characters isn't ignored.
This commit is contained in:
Gerhard Schlager
2018-11-21 22:07:13 +01:00
parent 58c795ef30
commit c376670bd2
2 changed files with 13 additions and 7 deletions

View File

@ -832,8 +832,8 @@ class Search
ts_config = ActiveRecord::Base.connection.quote(ts_config) if ts_config
all_terms = data.scan(/'([^']+)'\:\d+/).flatten
all_terms.map! do |t|
t.split(/[\)\(&']/)[0]
end.compact!
t.split(/[\)\(&']/).find(&:present?)
end.reject!(&:blank?)
query = ActiveRecord::Base.connection.quote(
all_terms