Class: Krikri::SearchIndexDocument

Inherits:
SolrDocument
  • Object
show all
Defined in:
app/models/krikri/search_index_document.rb

Overview

Subclass of Blacklight’s SolrDocument. Represents a single document returned from a query to the search index.

Instance Method Summary collapse

Instance Method Details

#aggregationDPLA::MAP::Aggregation?

Get the aggregation, populated with data from Marmotta, which corresponds to this SearchIndexDocument

Returns:

  • (DPLA::MAP::Aggregation, nil)


21
22
23
24
25
26
# File 'app/models/krikri/search_index_document.rb', line 21

def aggregation
  agg = DPLA::MAP::Aggregation.new(id)
  return nil unless agg.exists?
  agg.get
  agg
end

#to_paramObject

Use local name instead of full item id URI in route. For example, a document with the id ‘dp.la/marmotta/ldp/items/123ab’ will have an id param of ‘123ab’. This is necessary because routes that contain ‘.’ are not valid.

Returns:

  • String



13
14
15
# File 'app/models/krikri/search_index_document.rb', line 13

def to_param
  self[self.class.unique_key].match(/[\/]([^\/]*)\z/)[1]
end