Module: DbTextSearch
- Defined in:
- lib/db_text_search.rb,
lib/db_text_search/version.rb,
lib/db_text_search/full_text.rb,
lib/db_text_search/query_building.rb,
lib/db_text_search/case_insensitive.rb,
lib/db_text_search/full_text/mysql_adapter.rb,
lib/db_text_search/full_text/sqlite_adapter.rb,
lib/db_text_search/full_text/abstract_adapter.rb,
lib/db_text_search/full_text/postgres_adapter.rb,
lib/db_text_search/case_insensitive/lower_adapter.rb,
lib/db_text_search/case_insensitive/abstract_adapter.rb,
lib/db_text_search/case_insensitive/collate_nocase_adapter.rb,
lib/db_text_search/case_insensitive/insensitive_column_adapter.rb
Overview
DbTextSearch provides a unified interface on top of ActiveRecord for SQLite, MySQL, and PostgreSQL to do:
-
Case-insensitive string-in-set querying, and CI index creation.
-
Basic full-text search for a list of terms, and FTS index creation.
Defined Under Namespace
Modules: QueryBuilding Classes: CaseInsensitive, FullText
Constant Summary collapse
- VERSION =
Gem version
'1.0.0'
Class Method Summary collapse
-
.match_adapter(connection, mysql:, postgres:, sqlite:) ⇒ Object
private
Call the appropriate proc based on the adapter name.
-
.unsupported_adapter!(connection) ⇒ Object
private
Raises an ArgumentError with “Unsupported adapter #connectionconnection.adapter_name”.
Class Method Details
.match_adapter(connection, mysql:, postgres:, sqlite:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Call the appropriate proc based on the adapter name.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/db_text_search.rb', line 23 def self.match_adapter(connection, mysql:, postgres:, sqlite:) case connection.adapter_name when /mysql/i mysql.call when /postg/i # match all postgres and postgis adapters postgres.call when /sqlite/i sqlite.call else unsupported_adapter! connection end end |
.unsupported_adapter!(connection) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Raises an ArgumentError with “Unsupported adapter #connectionconnection.adapter_name”
39 40 41 |
# File 'lib/db_text_search.rb', line 39 def self.unsupported_adapter!(connection) fail ArgumentError, "Unsupported adapter #{connection.adapter_name}" end |