Skip to content

Commit

Permalink
Support PostGIS adapters. Fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Dec 1, 2016
1 parent 6831158 commit e02b463
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/db_text_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.match_adapter(connection, mysql:, postgres:, sqlite:)
case connection.adapter_name
when /mysql/i
mysql.call
when /postgres/i
when /postg/i # match all postgres and postgis adapters
postgres.call
when /sqlite/i
sqlite.call
Expand Down
4 changes: 2 additions & 2 deletions spec/db_text_search/case_insensitive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module DbTextSearch
if Name.connection.adapter_name =~ /mysql/i && column == :cs_name
next
end
if Name.connection.adapter_name =~ /postgres/i
if Name.connection.adapter_name =~ /postg/i
# Work around https://github.com/rails/rails/issues/24359
Name.connection.exec_query "DROP INDEX #{index_name}"
else
Expand All @@ -57,7 +57,7 @@ module DbTextSearch
force_index { expect(CaseInsensitive.new(Name, column).in('aBc')).to use_index(index_name) }
end
it 'uses an index for #prefix' do
if Name.connection.adapter_name =~ /postgres/i && column == :ci_name
if Name.connection.adapter_name =~ /postg/i && column == :ci_name
skip 'PostgreSQL does not use a LIKE index on citext columns'
end
force_index { expect(CaseInsensitive.new(Name, column).prefix('A')).to use_index(index_name) }
Expand Down

0 comments on commit e02b463

Please sign in to comment.