Project

General

Profile

Actions

Defect #20438

closed

Subject filter doesn't work with non ASCII uppercase symbols

Defect #20438: Subject filter doesn't work with non ASCII uppercase symbols

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

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
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 1 (0 open — 1 closed)

Related to Redmine - Defect #3536: Case sensitivity in Issue filteringClosedActions

Updated by Toshi MARUYAMA over 11 years ago Actions #1

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

Updated by Toshi MARUYAMA over 11 years ago Actions #2

  • Status changed from New to Needs feedback

Updated by Alexandr Raz over 11 years ago Actions #3

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

Updated by Toshi MARUYAMA over 11 years ago Actions #4

  • Category changed from Search engine to Database

Updated by Toshi MARUYAMA over 11 years ago Actions #5

  • 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 over 11 years ago Actions #6

  • 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 over 11 years ago Actions #7

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

Updated by Toshi MARUYAMA over 11 years ago Actions #8

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

Updated by Jean-Philippe Lang over 11 years ago Actions #9

  • Target version set to 3.1.1

Updated by Jean-Philippe Lang over 11 years ago Actions #10

  • 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.

Actions

Also available in: PDF Atom