Module: Flare::ActiveRecord::InstanceMethods
- Defined in:
- lib/flare/active_record.rb
Instance Method Summary collapse
Instance Method Details
#solr_destroy ⇒ Object
106 107 108 |
# File 'lib/flare/active_record.rb', line 106 def solr_destroy Flare.session.remove!(self) end |
#solr_document_id ⇒ Object
98 99 100 |
# File 'lib/flare/active_record.rb', line 98 def solr_document_id "#{self.class.name}:#{self.id}" end |
#solr_save ⇒ Object
102 103 104 |
# File 'lib/flare/active_record.rb', line 102 def solr_save Flare.session.index!(self) end |
#to_solr_doc ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/flare/active_record.rb', line 75 def to_solr_doc doc = { :fields => { :id => solr_document_id, :type => self.class.name }, :attributes => {} } solr_index[:fields].each do |field| value = send(field[:source]) # Need to convert dates to utc xmlschema. #TODO: move this translation to rsolr gem if value.respond_to?(:utc) value = value.utc.xmlschema end doc[:fields][field[:name]] = value end solr_index[:attributes].each do |key, value| doc[:attributes][key] = value.kind_of?(Symbol) ? send(value) : value end doc end |