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
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 :: ordered_aggregation :items, class_name: 'Item', through: :list_source indexed_ordered_aggregation :items end
In the example above, those two methods are
return the same data as the standard
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.
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.
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
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:
See the spec tests for details.
Add this line to your application's Gemfile:
And then execute:
$ bundle install
Or install it yourself via:
$ gem install speedy_af
Basecurrently tries to grab all relevant rows from Solr at once. Future releases will be more mindful of both local resources and Solr request limits.
Basemay not play nicely with language-tagged RDF literals, as ActiveFedora does not currently index/encode the language tag into Solr.
This software has been developed by and is brought to you by the Hydra community. Learn more at the Project Hydra website.