Class: Geoblacklight::Relation::Descendants

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

Instance Method Summary collapse

Constructor Details

#initialize(id, field, repository) ⇒ Descendants

Returns a new instance of Descendants.



6
7
8
9
10
# File 'lib/geoblacklight/relation/descendants.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/descendants.rb', line 12

def create_search_params
  {fq: "#{@field}:#{@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/descendants.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/descendants.rb', line 24

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