Code:

Docs:

SpeedyAF

This gem provides two mixins and a presenter designed to speed up ActiveFedora-based discovery and display operations.

This gem depends only upon ActiveFedora, not on Hydra or HydraHead

Table of Contents

Classes and Mixins

OrderedAggregationIndex

This mixin adds an indexed_ordered_aggregation(name) class method that, in turn, adds two methods to the including class.

class Container < ActiveFedora::Base
  include ActiveFedora::Associations
  include SpeedyAF::OrderedAggregationIndex

  ordered_aggregation :items, class_name: 'Item', through: :list_source
  indexed_ordered_aggregation :items
end

In the example above, those two methods are indexed_ordered_items and indexed_ordered_item_ids. They return the same data as the standard ordered_items and ordered_item_ids, respectively, but rely more on Solr and less on the Fedora repository. The _items variant returns a lazy enumerator that yields target objects instead of an ActiveFedora::Orders::TargetProxy, but the effect is similar.

IndexedContent

When mixed into an ActiveFedora::File descendant, it will index the resource's full content to Solr on save. This allows the {Base} to load it up without hitting Fedora.

Base

SpeedyAF::Base is designed to load everything it can about an ActiveFedora object from Solr, transparently lazy-loading and delegating calls to the underlying Fedora object only when necessary. It casts indexed attributes to their correct types, loads both indexed and unindexed subresources (See {IndexedContent}), and responds to most reflection accessors with another Base instance containing proxies for the desired objects.

A presenter (or array of presenters) can be instantiated by calling:

SpeedyAF::Base.find(item_pid) or SpeedyAF::Base.where(solr_query)

See the spec tests for details.

Installation

Add this line to your application's Gemfile:

gem 'speedy_af'

And then execute:

$ bundle install

Or install it yourself via:

$ gem install speedy_af

Help

If you have questions or need help, please email the Hydra community tech list or stop by the dev channel in the Hydra community Slack team:

Known Issues

Acknowledgments

This software has been developed by and is brought to you by the Hydra community. Learn more at the Project Hydra website.