Module: Xapor::ModelIntegration
- Includes:
- XapianFu
- Defined in:
- lib/xapor/model_integration.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 |
# File 'lib/xapor/model_integration.rb', line 3 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#add_to_index ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/xapor/model_integration.rb', line 53 def add_to_index doc = {:id => self.id} self.class.xapor_config.search_fields.each do |field| doc[field] = self.send(field.to_sym) end self.class.xapor_db << doc self.class.xapor_db.flush end |
#remove_from_index ⇒ Object
62 63 64 65 |
# File 'lib/xapor/model_integration.rb', line 62 def remove_from_index self.class.xapor_db.documents.delete(self.id) self.class.xapor_db.flush end |