Module: MakeTextSearch::ModelHelpers
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/make-text-search/models.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #text_search_build_document ⇒ Object
- #text_search_language ⇒ Object
- #text_search_remove_document ⇒ Object
- #text_search_update_document ⇒ Object
Instance Method Details
#text_search_build_document ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/make-text-search/models.rb', line 59 def text_search_build_document self.class.text_search_fields.map do |ts_field| field_name, = ts_field if value = send(field_name) value = value.to_s if filters = [:filter] filters.each {|f| value = f.apply_filter(self, value) } end value end end.compact.join(" ") end |
#text_search_language ⇒ Object
55 56 57 |
# File 'lib/make-text-search/models.rb', line 55 def text_search_language Rails.application.config.make_text_search.default_language end |
#text_search_remove_document ⇒ Object
49 50 51 52 53 |
# File 'lib/make-text-search/models.rb', line 49 def text_search_remove_document if not self.class.text_search_fields.blank? self.class.connection.text_search_adapter.remove_document self end end |
#text_search_update_document ⇒ Object
43 44 45 46 47 |
# File 'lib/make-text-search/models.rb', line 43 def text_search_update_document if not self.class.text_search_fields.blank? self.class.connection.text_search_adapter.update_document self end end |