Class: Geoblacklight::Relation::Ancestors

Inherits:
Object
  • Object
show all
Defined in:
lib/geoblacklight/relation/ancestors.rb

Instance Method Summary collapse

Constructor Details

#initialize(id, field, repository) ⇒ Ancestors

Returns a new instance of Ancestors.



6
7
8
9
10
# File 'lib/geoblacklight/relation/ancestors.rb', line 6

def initialize(id, field, repository)
  @search_id = id
  @field = field
  @repository = repository
end

Instance Method Details

#create_search_paramsObject



12
13
14
15
# File 'lib/geoblacklight/relation/ancestors.rb', line 12

def create_search_params
  {fq: ["{!join from=#{@field} to=#{Settings.FIELDS.ID}}#{Settings.FIELDS.ID}:#{@search_id}"],
   fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE]}
end

#execute_queryObject



17
18
19
20
21
22
# File 'lib/geoblacklight/relation/ancestors.rb', line 17

def execute_query
  @repository.connection.send_and_receive(
    @repository.blacklight_config.solr_path,
    params: create_search_params
  )
end

#resultsObject



24
25
26
27
# File 'lib/geoblacklight/relation/ancestors.rb', line 24

def results
  response = execute_query
  response["response"]
end