Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 4.17 KB

README.md

File metadata and controls

100 lines (67 loc) · 4.17 KB

Code: Version CircleCI Coverage Status Code Climate Dependency Status

Docs: Documentation Status API Docs Contribution Guidelines Apache 2.0 License

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: Slack Status

Known Issues

  • Base currently tries to grab all relevant rows from Solr at once. Future releases will be more mindful of both local resources and Solr request limits.
  • Base may not play nicely with language-tagged RDF literals, as ActiveFedora does not currently index/encode the language tag into Solr.

Acknowledgments

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

Project Hydra Logo