Defect #20438
closedSubject filter doesn't work with non ASCII uppercase symbols
0%
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
Updated by Toshi MARUYAMA almost 10 years ago
What db do you use?
If it is SQLite3, it does not work (r13760).
Updated by Toshi MARUYAMA almost 10 years ago
- Status changed from New to Needs feedback
Updated by Alexandr Raz almost 10 years ago
I'm using postgresql. I have a small experience with SQLite. How can I improve it?
Updated by Toshi MARUYAMA almost 10 years ago
- Category changed from Search engine to Database
Updated by Toshi MARUYAMA almost 10 years ago
- Subject changed from Search form doesn't work wtih cyrillic uppercase symbols. to Issue query doesn't work wtih non ASCII uppercase symbols.
- Category changed from Database to Issues
- Status changed from Needs feedback to New
- Target version set to 3.2.0
Updated by Toshi MARUYAMA almost 10 years ago
- Subject changed from Issue query doesn't work wtih non ASCII uppercase symbols. to Query doesn't work wtih non ASCII uppercase symbols.
- Category deleted (
Issues) - Target version deleted (
3.2.0)
Updated by Toshi MARUYAMA almost 10 years ago
- Related to Defect #3536: Case sensitivity in Issue filtering added
Updated by Toshi MARUYAMA almost 10 years ago
Updated by Jean-Philippe Lang over 9 years ago
- Subject changed from Query doesn't work wtih non ASCII uppercase symbols. to Subject filter doesn't work with non ASCII uppercase symbols
- Category set to Issues
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Target version changed from 3.1.1 to 3.2.0
- Resolution set to Fixed
Fixed in r14476.