Class: Hyrax::SolrDocument::OrderedMembers

Inherits:
ModelDecorator
  • Object
show all
Defined in:
app/models/concerns/hyrax/solr_document/ordered_members.rb

Overview

Note:

this decorator is intended for use with data representations other than the core model objects, as an alternative to a direct query of the canonical database. for example, it can be used with ‘SolrDocument` to quickly retrieve member order in a way that is compatible with the fast access required in Blacklight’s search contexts.

Decorates an object responding to ‘#id` with an `#ordered_member_ids` method.

Examples:

base_document = SolrDocument.new(my_work.to_solr)
solr_document = Hyrax::SolrDocument::OrderedMembers.decorate(base_document)

solr_document.ordered_member_ids # => ['abc', '123']

Instance Method Summary collapse

Methods inherited from ModelDecorator

#to_model

Instance Method Details

#ordered_member_idsEnumerable<String>

Note:

the purpose of this method is to provide fast access to member order. currently this is achieved by accessing indexed list proxies from Solr. however, this strategy may change in the future.

Returns ids in the order of their membership, only includes ids of ordered members.

Returns:

  • (Enumerable<String>)

    ids in the order of their membership, only includes ids of ordered members.



27
28
29
30
# File 'app/models/concerns/hyrax/solr_document/ordered_members.rb', line 27

def ordered_member_ids
  return [] if id.blank?
  @ordered_member_ids ||= query_for_ordered_ids
end