summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-13 18:36:35 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-13 18:36:35 +0000
commit6ad8ff4e13bc8ccf75a0cc857a0256422c9b05ca (patch)
tree694cfc830c6203f51562a7d57a86a3c4e74b8b73 /lib
parentc27e917843a6cfca04986bc3c6981e8744ef6e38 (diff)
downloadredmine-6ad8ff4e13bc8ccf75a0cc857a0256422c9b05ca.tar.gz
redmine-6ad8ff4e13bc8ccf75a0cc857a0256422c9b05ca.zip
Don't use #downcase on search tokens, let the database handle it (#18537).
git-svn-id: http://svn.redmine.org/redmine/trunk@13754 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
index fa5fa202b..37c8b400d 100644
--- a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
+++ b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
@@ -86,7 +86,7 @@ module Redmine
columns = searchable_options[:columns]
columns = columns[0..0] if options[:titles_only]
- token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE ?)"}
+ token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE LOWER(?))"}
if !options[:titles_only] && searchable_options[:search_custom_fields]
searchable_custom_fields = CustomField.where(:type => "#{self.name}CustomField", :searchable => true)
@@ -97,7 +97,7 @@ module Redmine
fields_by_visibility.each do |visibility, fields|
ids = fields.map(&:id).join(',')
sql = "#{table_name}.id IN (SELECT cfs.customized_id FROM #{CustomValue.table_name} cfs" +
- " WHERE cfs.customized_type='#{self.name}' AND cfs.customized_id=#{table_name}.id AND LOWER(cfs.value) LIKE ?" +
+ " WHERE cfs.customized_type='#{self.name}' AND cfs.customized_id=#{table_name}.id AND LOWER(cfs.value) LIKE LOWER(?)" +
" AND cfs.custom_field_id IN (#{ids})" +
" AND #{visibility})"
token_clauses << sql
@@ -106,7 +106,7 @@ module Redmine
sql = (['(' + token_clauses.join(' OR ') + ')'] * tokens.size).join(options[:all_words] ? ' AND ' : ' OR ')
- tokens_conditions = [sql, * (tokens.collect {|w| "%#{w.downcase}%"} * token_clauses.size).sort]
+ tokens_conditions = [sql, * (tokens.collect {|w| "%#{w}%"} * token_clauses.size).sort]
scope = (searchable_options[:scope] || self)
if scope.is_a? Proc