Defect #20438

Subject filter doesn't work with non ASCII uppercase symbols

Added by Alexandr Raz about 3 years ago. Updated about 3 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Issues
Target version:3.2.0
Resolution:Fixed Affected version:3.0.4

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 filtering Closed 2009-06-25

Associated revisions

Revision 14476
Added by Jean-Philippe Lang about 3 years ago

Query doesn't work with non ASCII uppercase symbols (#20438).

History

#1 Updated by Toshi MARUYAMA about 3 years ago

What db do you use?
If it is SQLite3, it does not work (r13760).

#2 Updated by Toshi MARUYAMA about 3 years ago

  • Status changed from New to Needs feedback

#3 Updated by Alexandr Raz about 3 years ago

I'm using postgresql. I have a small experience with SQLite. How can I improve it?

#4 Updated by Toshi MARUYAMA about 3 years ago

  • Category changed from Search engine to Database

#5 Updated by Toshi MARUYAMA about 3 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

#6 Updated by Toshi MARUYAMA about 3 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)

#7 Updated by Toshi MARUYAMA about 3 years ago

  • Related to Defect #3536: Case sensitivity in Issue filtering added

#8 Updated by Toshi MARUYAMA about 3 years ago

Please post by patch. I am confused with "query" and "search".
Please add tests like r2796 and r13767.

#9 Updated by Jean-Philippe Lang about 3 years ago

  • Target version set to 3.1.1

#10 Updated by Jean-Philippe Lang about 3 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.

Also available in: Atom PDF