| Module | ActiveRecord::Acts::Searchable::ActMethods |
| In: |
lib/acts_as_searchable.rb
|
If called with no parameters, gets whether the current model has changed and needs to updated in the index. If called with a single parameter, gets whether the parameter has changed.
# File lib/acts_as_searchable.rb, line 271
271: def changed?(attr_name = nil)
272: changed_attributes and (attr_name.nil? ?
273: (not changed_attributes.length.zero?) : (changed_attributes.include?(attr_name.to_s)) )
274: end
Retrieve index record for current model object
# File lib/acts_as_searchable.rb, line 260
260: def estraier_doc
261: cond = EstraierPure::Condition::new
262: cond.add_attr("db_id STREQ #{self.id}")
263: cond.add_attr("type STREQ #{self.class.to_s}")
264: result = self.estraier_connection.search(cond, 1)
265: return unless result and result.doc_num > 0
266: get_doc_from(result)
267: end
Update index for current instance
# File lib/acts_as_searchable.rb, line 253
253: def update_index(force = false)
254: return unless changed? or force
255: remove_from_index
256: add_to_index
257: end