Class: DbTextSearch::FullText::MysqlAdapter Private
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- DbTextSearch::FullText::MysqlAdapter
- Defined in:
- lib/db_text_search/full_text/mysql_adapter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Note:
MySQL v5.6.4+ is required.
Provides basic FTS support for MySQL.
Runs a ‘MATCH AGAINST` query against a `FULLTEXT` index.
Class Method Summary collapse
-
.add_index(connection, table_name, column_name, name:, pg_ts_config:) ⇒ Object
abstract
Add an index for full text search.
Instance Method Summary collapse
Methods inherited from AbstractAdapter
Methods included from QueryBuilding
Constructor Details
This class inherits a constructor from DbTextSearch::FullText::AbstractAdapter
Class Method Details
.add_index(connection, table_name, column_name, name:, pg_ts_config:) ⇒ Object
This method is abstract.
Add an index for full text search.
19 20 21 |
# File 'lib/db_text_search/full_text/mysql_adapter.rb', line 19 def self.add_index(connection, table_name, column_name, name:, pg_ts_config:) connection.add_index table_name, column_name, name: name, type: :fulltext end |
Instance Method Details
#search(terms, pg_ts_config:) ⇒ ActiveRecord::Relation
This method is abstract.
14 15 16 |
# File 'lib/db_text_search/full_text/mysql_adapter.rb', line 14 def search(terms, pg_ts_config:) @scope.where("MATCH (#{quoted_scope_column}) AGAINST (?)", terms.uniq.join(' ')) end |