Module: Sunspot::Rails::Searchable::InstanceMethods
- Defined in:
- lib/sunspot/rails/searchable.rb
Instance Method Summary collapse
-
#index ⇒ Object
Index the model in Solr.
-
#index! ⇒ Object
Index the model in Solr and immediately commit.
-
#remove_from_index ⇒ Object
Remove the model from the Solr index.
-
#remove_from_index! ⇒ Object
Remove the model from the Solr index and commit immediately.
Instance Method Details
#index ⇒ Object
Index the model in Solr. If the model is already indexed, it will be updated. Using the defaults, you will usually not need to call this method, as models are indexed automatically when they are created or updated. If you have disabled automatic indexing (see ClassMethods#searchable), this method allows you to manage indexing manually.
277 278 279 |
# File 'lib/sunspot/rails/searchable.rb', line 277 def index Sunspot.index(self) end |
#index! ⇒ Object
Index the model in Solr and immediately commit. See #index
284 285 286 |
# File 'lib/sunspot/rails/searchable.rb', line 284 def index! Sunspot.index!(self) end |
#remove_from_index ⇒ Object
Remove the model from the Solr index. Using the defaults, this should not be necessary, as models will automatically be removed from the index when they are destroyed. If you disable automatic removal (which is not recommended!), you can use this method to manage removal manually.
295 296 297 |
# File 'lib/sunspot/rails/searchable.rb', line 295 def remove_from_index Sunspot.remove(self) end |
#remove_from_index! ⇒ Object
Remove the model from the Solr index and commit immediately. See #remove_from_index
303 304 305 |
# File 'lib/sunspot/rails/searchable.rb', line 303 def remove_from_index! Sunspot.remove!(self) end |