Defect #20438
closed
Subject filter doesn't work with non ASCII uppercase symbols
Added by Alexandr Raz almost 10 years ago.
Updated almost 10 years ago.
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))}"
What db do you use?
If it is SQLite3, it does not work (r13760).
- Status changed from New to Needs feedback
I'm using postgresql. I have a small experience with SQLite. How can I improve it?
- Category changed from Search engine to Database
- 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
- 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)
- Related to Defect #3536: Case sensitivity in Issue filtering added
Please post by patch. I am confused with "query" and "search".
Please add tests like r2796 and r13767.
- Target version set to 3.1.1
- 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
Also available in: Atom
PDF