Class: Solrizer::Fedora::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/solrizer/fedora/repository.rb

Class Method Summary collapse

Class Method Details

.get_datastream(obj, ds_name) ⇒ Object

This method retrieves the datastream for the given object with the given datastream name



35
36
37
38
39
40
41
# File 'lib/solrizer/fedora/repository.rb', line 35

def self.get_datastream( obj, ds_name )
  begin
    obj.datastreams[ ds_name ]
  rescue
    return nil
  end
end

.get_datastreams(obj) ⇒ Object

This method retrieves a comprehensive list of datastreams for the given object



28
29
30
# File 'lib/solrizer/fedora/repository.rb', line 28

def self.get_datastreams( obj )
  ds_keys = obj.datastreams.keys
end

.get_object(pid) ⇒ Object

This method retrieves the object associated with the given unique id



21
22
23
# File 'lib/solrizer/fedora/repository.rb', line 21

def self.get_object( pid )
  object = ActiveFedora::Base.find( pid )
end

.get_pids(num_docs) ⇒ Object

This method retrieves a comprehensive list of unique ids in the fedora repository



9
10
11
12
13
14
15
16
# File 'lib/solrizer/fedora/repository.rb', line 9

def self.get_pids( num_docs )
  solr_results = ActiveFedora::SolrService.instance.conn.query( "active_fedora_model_field:Document", { :rows => num_docs } )
  id_array = []
  solr_results.hits.each do |hit|
    id_array << hit[SOLR_DOCUMENT_ID]
  end
  return id_array
end