Project

General

Profile

Actions

Defect #20438

closed

Subject filter doesn't work with non ASCII uppercase symbols

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

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
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

Related to Redmine - Defect #3536: Case sensitivity in Issue filteringClosed2009-06-25

Actions
Actions #1

Updated by Toshi MARUYAMA over 9 years ago

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

Actions #2

Updated by Toshi MARUYAMA over 9 years ago

  • Status changed from New to Needs feedback
Actions #3

Updated by Alexandr Raz over 9 years ago

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

Actions #4

Updated by Toshi MARUYAMA over 9 years ago

  • Category changed from Search engine to Database
Actions #5

Updated by Toshi MARUYAMA over 9 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
Actions #6

Updated by Toshi MARUYAMA over 9 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)
Actions #7

Updated by Toshi MARUYAMA over 9 years ago

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

Updated by Toshi MARUYAMA over 9 years ago

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

Actions #9

Updated by Jean-Philippe Lang over 9 years ago

  • Target version set to 3.1.1
Actions #10

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.

Actions

Also available in: Atom PDF