Module: ActiveFedora::QueryResultBuilder

Defined in:
lib/active_fedora/query_result_builder.rb

Constant Summary collapse

HAS_MODEL_SOLR_FIELD =
ActiveFedora.index_field_mapper.solr_name("has_model", :symbol).freeze

Class Method Summary collapse

Class Method Details

.class_from_solr_document(hit, opts = {}) ⇒ Object

Returns the best singular class for the solr object



27
28
29
30
# File 'lib/active_fedora/query_result_builder.rb', line 27

def self.class_from_solr_document(hit, opts = {})
  Deprecation.warn(ActiveFedora::Base, 'ActiveFedora::QueryResultBuilder.class_from_solr_document is deprecated and will be removed in ActiveFedora 10.0; call #model on the SolrHit instead.')
  ActiveFedora::SolrHit.for(hit).model(opts)
end

.classes_from_solr_document(hit, _opts = {}) ⇒ Object

Returns all possible classes for the solr object



21
22
23
24
# File 'lib/active_fedora/query_result_builder.rb', line 21

def self.classes_from_solr_document(hit, _opts = {})
  Deprecation.warn(ActiveFedora::Base, 'ActiveFedora::QueryResultBuilder.classes_from_solr_document is deprecated and will be removed in ActiveFedora 10.0; call #models on the SolrHit instead.')
  ActiveFedora::SolrHit.for(hit).models
end

.lazy_reify_solr_results(solr_results, opts = {}) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/active_fedora/query_result_builder.rb', line 3

def self.lazy_reify_solr_results(solr_results, opts = {})
  return to_enum(:lazy_reify_solr_results, solr_results, opts) unless block_given?

  solr_results.each do |hit|
    yield ActiveFedora::SolrHit.for(hit).reify(opts)
  end
end

.reify_solr_result(hit, _opts = {}) ⇒ Object



15
16
17
18
# File 'lib/active_fedora/query_result_builder.rb', line 15

def self.reify_solr_result(hit, _opts = {})
  Deprecation.warn(ActiveFedora::Base, 'ActiveFedora::QueryResultBuilder.reify_solr_result is deprecated and will be removed in ActiveFedora 10.0; call #reify on the SolrHit instead.')
  ActiveFedora::SolrHit.for(hit).reify
end

.reify_solr_results(solr_results, opts = {}) ⇒ Object



11
12
13
# File 'lib/active_fedora/query_result_builder.rb', line 11

def self.reify_solr_results(solr_results, opts = {})
  lazy_reify_solr_results(solr_results, opts).to_a
end