Module: ActiveFedora::Indexing::ClassMethods
- Defined in:
- lib/active_fedora/indexing.rb
Instance Method Summary collapse
-
#load_instance_from_solr(pid, solr_doc = nil) ⇒ Object
This method can be used instead of ActiveFedora::Model::ClassMethods.find.
-
#reindex_everything(query = nil) ⇒ Object
Using the fedora search (not solr), get every object and reindex it.
Instance Method Details
#load_instance_from_solr(pid, solr_doc = nil) ⇒ Object
This method can be used instead of ActiveFedora::Model::ClassMethods.find. It works similarly except it populates an object from Solr instead of Fedora. It is most useful for objects used in read-only displays in order to speed up loading time. If only a pid is passed in it will query solr for a corresponding solr document and then use it to populate this object.
If a value is passed in for optional parameter solr_doc it will not query solr again and just use the one passed to populate the object.
It will anything stored within solr such as metadata and relationships. Non-metadata datastreams will not be loaded and if needed you should use find instead.
85 86 87 |
# File 'lib/active_fedora/indexing.rb', line 85 def load_instance_from_solr(pid,solr_doc=nil) SolrInstanceLoader.new(self, pid, solr_doc).object end |
#reindex_everything(query = nil) ⇒ Object
Using the fedora search (not solr), get every object and reindex it.
92 93 94 95 96 97 98 99 |
# File 'lib/active_fedora/indexing.rb', line 92 def reindex_everything(query = nil) connections.each do |conn| conn.search(query) do |object| next if object.pid.start_with?('fedora-system:') ActiveFedora::Base.find(object.pid, :cast=>true).update_index end end end |