Module: Sequel::Plugins::TextSearchable::ClassMethods

Defined in:
lib/sequel/plugins/text_searchable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#text_search_columnObject

Returns the value of attribute text_search_column.



38
39
40
# File 'lib/sequel/plugins/text_searchable.rb', line 38

def text_search_column
  @text_search_column
end

#text_search_optionsObject

Returns the value of attribute text_search_options.



38
39
40
# File 'lib/sequel/plugins/text_searchable.rb', line 38

def text_search_options
  @text_search_options
end

#text_search_termsObject

Returns the value of attribute text_search_terms.



38
39
40
# File 'lib/sequel/plugins/text_searchable.rb', line 38

def text_search_terms
  @text_search_terms
end

Instance Method Details

#text_search_columns_and_ranksObject

Raises:

  • (NotImplementedError)


57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/sequel/plugins/text_searchable.rb', line 57

def text_search_columns_and_ranks
  raise NotImplementedError, "#{self.name} must implement text_search_terms" if
    self.text_search_terms.nil?
  return self.text_search_terms.map do |t|
    if t.is_a?(Array)
      col, rank = t
    elsif t.is_a?(Hash)
      col, rank = t.to_a.first
    else
      col = t
      rank = nil
    end
    [col, rank]
  end
end

#text_search_languageObject



40
# File 'lib/sequel/plugins/text_searchable.rb', line 40

def text_search_language = self.text_search_options.fetch(:language)

#text_search_reindex_allObject



42
43
44
45
46
47
48
49
# File 'lib/sequel/plugins/text_searchable.rb', line 42

def text_search_reindex_all
  did = 0
  self.dataset.paged_each do |m|
    m.text_search_reindex
    did += 1
  end
  return did
end

#text_search_reindex_model(model_pk) ⇒ Object



51
52
53
54
55
# File 'lib/sequel/plugins/text_searchable.rb', line 51

def text_search_reindex_model(model_pk)
  m = self.with_pk!(model_pk)
  m.text_search_reindex
  return m
end