Skip to content

Loading Objects from Solr

mbklein edited this page Apr 23, 2012 · 1 revision

Overview

The ActiveFedora::Base.load_instance_from_solr method provides a lightweight, quick-loading version of an ActiveFedora model, with object and datastream profile information loaded from the Solr index. Datastream content can be instantiated from Solr as well if the datastream class implements a from_solr method. Otherwise, content is lazy-loaded from the repository, allowing quick read-only access to data with a minimum of calls to Fedora.

The resulting object has two methods, reify and its in-place sibling, reify!, which allow the lightweight object to return (or convert itself into) a full-fledged digital object.

Indexing Concerns

Object and Datastream profiles are persisted to the Solr document as a single JSON string, call (by default) object_profile_display. If that field is not present, or cannot be parsed, ActiveFedora will raise an ObjectNotFoundError. Serialization and deserialization of profiles are provided by ActiveFedora::Base#solrize_profile, ActiveFedora::Datastream#solrize_profile, ActiveFedora::SolrDigitalObject.initialize, and ActiveFedora::Datastream#profile_from_hash.

Clone this wiki locally