Module: Sequel::Plugins::TextSearchable::ClassMethods
- Defined in:
- lib/sequel/plugins/text_searchable.rb
Instance Attribute Summary collapse
-
#text_search_column ⇒ Object
Returns the value of attribute text_search_column.
-
#text_search_options ⇒ Object
Returns the value of attribute text_search_options.
-
#text_search_terms ⇒ Object
Returns the value of attribute text_search_terms.
Instance Method Summary collapse
- #text_search_columns_and_ranks ⇒ Object
- #text_search_language ⇒ Object
- #text_search_reindex_all ⇒ Object
- #text_search_reindex_model(model_pk) ⇒ Object
Instance Attribute Details
#text_search_column ⇒ Object
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_options ⇒ Object
Returns the value of attribute text_search_options.
38 39 40 |
# File 'lib/sequel/plugins/text_searchable.rb', line 38 def @text_search_options end |
#text_search_terms ⇒ Object
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_ranks ⇒ Object
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_language ⇒ Object
40 |
# File 'lib/sequel/plugins/text_searchable.rb', line 40 def text_search_language = self..fetch(:language) |
#text_search_reindex_all ⇒ Object
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 |