Class: DbTextSearch::FullText::SqliteAdapter Private
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- DbTextSearch::FullText::SqliteAdapter
- Defined in:
- lib/db_text_search/full_text/sqlite_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:
.add_index is a no-op.
Provides very basic FTS support for SQLite.
Runs a ‘LIKE %term%` query for each term, joined with `AND`. Cannot use an index.
Class Method Summary collapse
-
.add_index(_connection, _table_name, _column_name, name:, pg_ts_config:) ⇒ Object
private
A no-op, as we just use LIKE for sqlite.
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 part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A no-op, as we just use LIKE for sqlite.
23 |
# File 'lib/db_text_search/full_text/sqlite_adapter.rb', line 23 def self.add_index(_connection, _table_name, _column_name, name:, pg_ts_config:); end |
Instance Method Details
#search(terms, pg_ts_config:) ⇒ ActiveRecord::Relation
This method is abstract.
15 16 17 18 19 20 |
# File 'lib/db_text_search/full_text/sqlite_adapter.rb', line 15 def search(terms, pg_ts_config:) quoted_col = quoted_scope_column terms.map(&:downcase).uniq.inject(@scope) do |scope, term| scope.where("#{quoted_col} COLLATE NOCASE LIKE ?", "%#{sanitize_sql_like term}%") end end |