Vote #76607
完了Subject filter doesn't work with non ASCII uppercase symbols
0%
説明
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))}"@
journals
What db do you use?
If it is SQLite3, it does not work (r13760).
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
I'm using postgresql. I have a small experience with SQLite. How can I improve it?
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Please post by patch. I am confused with "query" and "search".
Please add tests like r2796 and r13767.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Fixed in r14476.
--------------------------------------------------------------------------------
related_issues
relates,Closed,3536,Case sensitivity in Issue filtering