Skip to content

Commit

Permalink
Merge pull request #1175 from pulibrary/sibling-ids-present
Browse files Browse the repository at this point in the history
ensure sibling ids are present for linked doc query
  • Loading branch information
escowles authored Jan 26, 2018
2 parents accdc39 + 88fc8d8 commit d3eb770
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Metrics/AbcSize:
- 'app/models/concerns/blacklight/solr/document/marc.rb'
- 'app/models/concerns/blacklight/document/dublin_core.rb'
- 'app/models/concerns/blacklight/document/ris.rb'
- 'app/services/linked_document_resolver.rb'
- 'config/initializers/requests_initializer.rb'
- 'lib/orangelight/bibdata.rb'
- 'lib/orangelight/browse_lists.rb'
Expand Down
3 changes: 2 additions & 1 deletion app/services/linked_document_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def initialize(root:, siblings:, solr_field:)
# Retrieves the Solr documents for each adjacent node
# @return [Array<SolrDocument>] sibling documents
def siblings
return [] unless response.key?('response') && !response['response']['docs'].empty?
return [] unless @siblings.present? && response.key?('response') &&
!response['response']['docs'].empty?

sibling_docs = response['response']['docs'].reject { |document| document['id'] == @root }
sibling_docs.map { |document| SolrDocument.new(document) }
Expand Down

0 comments on commit d3eb770

Please sign in to comment.