Project

General

Profile

Actions

Defect #1608

closed

Case-insensitive search

Added by Denis Tomashenko over 16 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Search engine
Target version:
-
Start date:
2008-07-09
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Case-insensitive search doesn't work, but it would be great.

Actions #1

Updated by Jean-Philippe Lang over 16 years ago

  • Tracker changed from Patch to Defect
Actions #2

Updated by Jean-Philippe Lang over 16 years ago

Please give redmine, database, ruby, rails... versions as requested in SubmittingBugs.

Case-insensitive search works here:
http://www.redmine.org/search/index/redmine?q=caSe+inSENsitiVe

Actions #3

Updated by Denis Tomashenko over 16 years ago

Jean-Philippe Lang wrote:

Please give redmine, database, ruby, rails... versions as requested in SubmittingBugs.

Sorry...

Redmine 0.7.devel r1643
Apache 2.2.8
MySQL 5.0.51a
Subversion 1.5.0
Ruby 1.8.6
Rails 2.1.0
RubyGems 1.0.1

Actions #4

Updated by Denis Tomashenko over 16 years ago

May be non latin characters?

Actions #5

Updated by Thomas Löber over 16 years ago

What is the character set and collation of your database?

mysql> show variables like 'character_set%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

mysql> show variables like 'collation%';
+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_general_ci |
| collation_server     | utf8_general_ci |
+----------------------+-----------------+
Actions #6

Updated by Denis Tomashenko over 16 years ago

I sorry again...
MySQL 5.0.45

Variable_name Value
-------------------------------------------------------------------------------+
character_set_client latin1
character_set_connection latin1
character_set_database latin1
character_set_filesystem binary
character_set_results latin1
character_set_server latin1
character_set_system utf8
collation_connection latin1_swedish_ci
collation_database latin1_swedish_ci
collation_server latin1_swedish_ci

latin1... May be this is a problem?
But all characters in Redmine show correctly.

Actions #7

Updated by Denis Tomashenko over 16 years ago

  • Status changed from New to Resolved

After converting data in UTF8 case insensitive search work fine.
But in search results founded words (non latin characters) is not highlighted. For latin characters all ok.
This is a bug?

Actions #8

Updated by Jean-Philippe Lang almost 16 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Invalid

Please submit a detailled ticket about the last problem you mentionned if needed.

Actions #9

Updated by Dmitry K over 15 years ago

How can i make case insensitive search with redmine installation on windows server?

Actions #10

Updated by Alex A over 13 years ago

I have the same problem for postgresql, and i solve it by patching file search_controller.rb.
I`v add this

like_tokens = @tokens.collect {|w| "%#{Unicode::downcase(w)}%" } 
r, c = s.singularize.camelcase.constantize.search(like_tokens, projects_to_search, 

instead of
r, c = s.singularize.camelcase.constantize.search(@tokes, projects_to_search, 

For working you must install gem package unicode (gem install unicode) and add in the top of file search_controller.rb

require 'unicode'

Actions #11

Updated by Ilya Turkin over 10 years ago

Hello,

can i try to reopen it?

I want to admit that the issue contains in version 2.4.6. It can be fixed in lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb by adding mb_chars:

tokens_conditions = [sql, * (tokens.collect {|w| "%#{w.mb_chars.downcase}%"} * token_clauses.size).sort]
Redmine version 2.4.6.stable.13231
Ruby version 1.9.2-p290 (2011-07-09) [x86_64-linux]
Rails version 3.2.19
Actions #12

Updated by Toshi MARUYAMA over 10 years ago

Ilya Turkin wrote:

Ruby version 1.9.2-p290 (2011-07-09) [x86_64-linux]

Too old.

Actions #13

Updated by Ilya Turkin over 10 years ago

Hi, Toshi,

ruby version does not matter in the case because String#downcase is working only with ASCII symbols at latest ruby version too:

 downcase → new_str

Returns a copy of str with all uppercase letters replaced with their lowercase counterparts.
The operation is locale insensitive—only characters “A” to “Z” are affected. 
Note: case replacement is effective only in ASCII region.

"hEllO".downcase   #=> "hello" 

See ruby 2.1 String#downcase if you please.

Actions #14

Updated by Toshi MARUYAMA over 10 years ago

I see. But, case sensitivity depends heavily on Ruby version and DB adapter.
We cannot test on such too old Ruby version.
See http://www.redmine.org/builds/index.html .

Actions #15

Updated by Ilya Turkin over 10 years ago

OK, so if I understand you right when I start to use a shiny new ruby version you will fix it? If it is I move my production to new ruby version next week and come back, OK? :)

Actions #16

Updated by Toshi MARUYAMA over 10 years ago

Ilya Turkin wrote:

OK, so if I understand you right when I start to use a shiny new ruby version you will fix it?

I welcome you to post patch which includes tests for all Redmine support DB and Ruby version.

If it is I move my production to new ruby version next week and come back, OK? :)

Please create new issue.

Actions

Also available in: Atom PDF