Class: DbTextSearch::CaseInsensitive::AbstractAdapter Abstract Private

Inherits:
Object
  • Object
show all
Includes:
QueryBuilding
Defined in:
lib/db_text_search/case_insensitive/abstract_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.

This class is abstract.

A base class for CaseInsensitiveStringFinder adapters.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from QueryBuilding

included, #sanitize_sql_like

Constructor Details

#initialize(scope, column) ⇒ AbstractAdapter

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.

Returns a new instance of AbstractAdapter.

Parameters:

  • scope (ActiveRecord::Relation, Class<ActiveRecord::Base>)
  • column (Symbol)

    name



14
15
16
17
# File 'lib/db_text_search/case_insensitive/abstract_adapter.rb', line 14

def initialize(scope, column)
  @scope  = scope
  @column = column
end

Class Method Details

.add_index(connection, table_name, column_name, options = {}) ⇒ 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.

This method is abstract.

Add an index for case-insensitive string search.

Parameters:

  • connection (ActiveRecord::ConnectionAdapters::AbstractAdapter)
  • table_name (String, Symbol)
  • column_name (String, Symbol)
  • options (Hash) (defaults to: {})

    passed down to ActiveRecord::ConnectionAdapters::SchemaStatements#add_index.

Options Hash (options):

  • name (String)

    index name

  • unique (Boolean)

    default: false



49
50
51
# File 'lib/db_text_search/case_insensitive/abstract_adapter.rb', line 49

def self.add_index(connection, table_name, column_name, options = {})
  fail 'abstract'
end

Instance Method Details

#column_for_order(asc_or_desc) ⇒ Arel::Collectors::SQLString

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.

This method is abstract.

Parameters:

  • asc_or_desc (Symbol)

Returns:

  • (Arel::Collectors::SQLString)


36
37
38
# File 'lib/db_text_search/case_insensitive/abstract_adapter.rb', line 36

def column_for_order(asc_or_desc)
  fail 'abstract'
end

#in(values) ⇒ ActiveRecord::Relation

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.

This method is abstract.

Parameters:

  • values (Array<String>)

Returns:

  • (ActiveRecord::Relation)


22
23
24
# File 'lib/db_text_search/case_insensitive/abstract_adapter.rb', line 22

def in(values)
  fail 'abstract'
end

#prefix(query) ⇒ ActiveRecord::Relation

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.

This method is abstract.

Parameters:

  • query (String)

Returns:

  • (ActiveRecord::Relation)


29
30
31
# File 'lib/db_text_search/case_insensitive/abstract_adapter.rb', line 29

def prefix(query)
  fail 'abstract'
end