Project

General

Profile

Actions

Defect #20438

closed

Subject filter doesn't work with non ASCII uppercase symbols

Added by Alexandr Raz over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

If you search by containing cyrillic uppercase symbols, you get empty result. The query for search looks like

when "~"
sql = "LOWER(#{db_table}.#{db_field}) LIKE '%#{self.class.connection.quote_string(value.first.to_s.downcase)}%'"

but ruby function downcase wokrs only with latin symbols.

We add special private method:

def like_operator(content)
if Redmine::Database.postgresql?
"ILIKE '%#{content}%' "
else
"LIKE LOWER(#{content})"
end
end

and override method sql_for_field

when "~"
sql = "LOWER(#{db_table}.#{db_field}) #{like_operator(self.class.connection.quote_string(value.first.to_s.downcase))}"
when "!~"
sql = "LOWER(#{db_table}.#{db_field}) NOT #{like_operator(self.class.connection.quote_string(value.first.to_s.downcase))}"


Related issues

Related to Redmine - Defect #3536: Case sensitivity in Issue filteringClosed2009-06-25

Actions
Actions

Also available in: Atom PDF