Project

General

Profile

Actions

Defect #19273

closed

acts_as_searchable.rb only seems to be case insensitive if postgresql

Added by Marc Tardif over 9 years ago. Updated over 9 years ago.

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

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

In acts_as_searchable.rb, I see the following code:

          def search_token_match_statement(column, value='?')
            if Redmine::Database.postgresql?
              if Redmine::Database.postgresql_unaccent?
                "unaccent(#{column}) ILIKE unaccent(#{value})" 
              else
                "#{column} ILIKE #{value}" 
              end
            else
              "#{column} LIKE #{value}" 
            end
          end

It seems that the last else statement should read something like "LOWER(#{column}) LIKE #{value.lowercase}". I believe that's what Redmine pre-3 did.


Related issues

Related to Redmine - Defect #20042: A test fail when running it with PostgreSQLClosedGo MAEDA

Actions
Actions #1

Updated by Toshi MARUYAMA over 9 years ago

  • Target version set to 3.0.1
Actions #2

Updated by Toshi MARUYAMA over 9 years ago

  • Description updated (diff)
Actions #3

Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from New to Closed
  • Target version deleted (3.0.1)
  • Resolution set to Invalid

No, LIKE is case insensitive for databases other than PostgreSQL. Have a look at SearchTest#test_search_should_be_case_insensitive:
source:/tags/3.0.0/test/unit/search_test.rb#L145

Actions #4

Updated by Vincent Robert over 9 years ago

I don't know if it's related, but when running the test suite against PostgreSQL, this test fails:

Minitest::Assertion: "Bug #16: Special chars: Öö" not found in "[#<Issue id: 15, tracker_id: 1, project_id: 1, subject: "Special chars: ÖÖ", description: nil, due_date: nil, category_id: nil, status_id: 1, assigned_to_id: nil, priority_id: 5, fixed_version_id: nil, author_id: 2, lock_version: 0, created_on: "2015-04-27 10:19:13", updated_on: "2015-04-27 10:19:13", start_date: nil, done_ratio: 0, estimated_hours: nil, parent_id: nil, root_id: 15, lft: 1, rgt: 2, is_private: false, closed_on: nil>]" 
test/unit/search_test.rb:159:in `test_search_should_be_case_insensitive_with_accented_characters'

Actions #5

Updated by Toshi MARUYAMA over 9 years ago

  • Related to Defect #20042: A test fail when running it with PostgreSQL added
Actions

Also available in: Atom PDF