Skip to content

Commit ea30fb3

Browse files
authored
Merge pull request #1580 from projectblacklight/rm-legacy-parent-ids
Remove deprecated legacy_parent_ids
2 parents bf3cad5 + cfe7617 commit ea30fb3

File tree

7 files changed

+11
-66
lines changed

7 files changed

+11
-66
lines changed

app/models/arclight/parents.rb

+4-6
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ module Arclight
55
# Object for parsing and formalizing Solr_Ead "Parents"
66
# https://github.com/awead/solr_ead/blob/8cf7ffaa66e0e4c9c0b12f5646d6c2e20984cd99/lib/solr_ead/behaviors.rb#L54-L57
77
class Parents
8-
attr_reader :ids, :legacy_ids, :labels, :levels
8+
attr_reader :ids, :labels, :levels
99

10-
def initialize(ids:, legacy_ids:, labels:, eadid:, levels:)
10+
def initialize(ids:, labels:, eadid:, levels:)
1111
@ids = ids
12-
@legacy_ids = legacy_ids
1312
@labels = labels
1413
@eadid = eadid
1514
@levels = levels
@@ -22,18 +21,17 @@ def eadid
2221
##
2322
# @return [Array[Arclight::Parent]]
2423
def as_parents
25-
(ids.presence || legacy_ids).map.with_index { |id, idx| Arclight::Parent.new(id: id, label: labels[idx], eadid: eadid, level: levels[idx]) }
24+
ids.map.with_index { |id, idx| Arclight::Parent.new(id: id, label: labels[idx], eadid: eadid, level: levels[idx]) }
2625
end
2726

2827
##
2928
# @param [SolrDocument] document
3029
def self.from_solr_document(document)
3130
ids = document.parent_ids
32-
legacy_ids = document.legacy_parent_ids.map { |legacy_id| document.collection_id == legacy_id ? legacy_id : "#{document.collection_id}#{legacy_id}" }
3331
labels = document.parent_labels
3432
eadid = document.eadid
3533
levels = document.parent_levels
36-
new(ids: ids, legacy_ids: legacy_ids, labels: labels, eadid: eadid, levels: levels)
34+
new(ids: ids, labels: labels, eadid: eadid, levels: levels)
3735
end
3836
end
3937
end

app/models/concerns/arclight/solr_document.rb

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ module SolrDocument
99
included do
1010
attribute :collection_id, :string, '_root_'
1111
attribute :parent_ids, :array, 'parent_ids_ssim'
12-
attribute :legacy_parent_ids, :array, 'parent_ssim'
13-
Arclight.deprecation.deprecate_methods(self, legacy_parent_ids: 'Use `parent_ids` instead')
1412
attribute :parent_labels, :array, 'parent_unittitles_ssm'
1513
attribute :parent_levels, :array, 'parent_levels_ssm'
1614
attribute :unitid, :string, 'unitid_ssm'

lib/arclight/traject/ead2_component_config.rb

-5
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@
130130
accumulator << (settings[:depth] || 1)
131131
end
132132

133-
to_field 'parent_ssim' do |_record, accumulator, _context|
134-
accumulator.concat(settings[:parent].output_hash['parent_ssim'] || [])
135-
accumulator.concat settings[:parent].output_hash['ref_ssi'] || settings[:parent].output_hash['id']
136-
end
137-
138133
to_field 'parent_ssi' do |_record, accumulator, _context|
139134
accumulator.concat settings[:parent].output_hash['ref_ssi'] || settings[:parent].output_hash['id']
140135
end

spec/components/arclight/breadcrumb_component_spec.rb

-19
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,4 @@
5656
expect(rendered).to have_link 'DEF', href: '/catalog/abc123_def'
5757
expect(rendered).to have_link 'GHI', href: '/catalog/abc123_ghi'
5858
end
59-
60-
context 'with legacy parent_ssm data' do
61-
let(:legacy_document) do
62-
SolrDocument.new(
63-
parent_ssim: %w[abc123 def ghi],
64-
parent_unittitles_ssm: %w[ABC123 DEF GHI],
65-
ead_ssi: 'abc123',
66-
repository_ssm: 'my repository',
67-
_root_: 'abc123'
68-
)
69-
end
70-
71-
let(:component) { described_class.new(document: legacy_document, **attr) }
72-
73-
it 'renders breadcrumb links' do
74-
expect(rendered).to have_link 'DEF', href: '/catalog/abc123def'
75-
expect(rendered).to have_link 'GHI', href: '/catalog/abc123ghi'
76-
end
77-
end
7859
end

spec/features/traject/ead2_indexing_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ def components(result)
239239
)
240240

241241
expect(nested_component['component_level_isim']).to eq [2]
242-
expect(nested_component['parent_ssim']).to eq %w[lc0100 aspace_327a75c226d44aa1a769edb4d2f13c6e]
243242
expect(nested_component['parent_ssi']).to eq ['aspace_327a75c226d44aa1a769edb4d2f13c6e']
243+
expect(nested_component['parent_ids_ssim']).to eq %w[lc0100 lc0100_aspace_327a75c226d44aa1a769edb4d2f13c6e]
244244
expect(nested_component['parent_unittitles_ssm']).to eq ['Large collection sample, 1843-1872', 'File 1']
245245
end
246246
end
@@ -449,10 +449,10 @@ def components(result)
449449
end
450450

451451
it 'parents are correctly ordered' do
452-
expect(component_with_many_parents['parent_ssim']).to eq %w[
452+
expect(component_with_many_parents['parent_ids_ssim']).to eq %w[
453453
aoa271
454-
aspace_563a320bb37d24a9e1e6f7bf95b52671
455-
aspace_238a0567431f36f49acea49ef576d408
454+
aoa271_aspace_563a320bb37d24a9e1e6f7bf95b52671
455+
aoa271_aspace_238a0567431f36f49acea49ef576d408
456456
]
457457
end
458458

@@ -688,8 +688,8 @@ def components(result)
688688
expect(second_component['ref_ssi']).to contain_exactly('al_54b06e5ad77cab05ec7f6beeaca50022c47d9c7b')
689689
expect(second_component['id']).to contain_exactly('ehllHemingwayErnest-sample_al_54b06e5ad77cab05ec7f6beeaca50022c47d9c7b')
690690

691-
expect(second_component['parent_ssim']).to equal_array_ignoring_whitespace(
692-
%w[ehllHemingwayErnest-sample al_4bf70b448ac8351a147acff1dd8b1c0b9a791980]
691+
expect(second_component['parent_ids_ssim']).to equal_array_ignoring_whitespace(
692+
%w[ehllHemingwayErnest-sample ehllHemingwayErnest-sample_al_4bf70b448ac8351a147acff1dd8b1c0b9a791980]
693693
)
694694
end
695695
end

spec/models/arclight/parents_spec.rb

+1-27
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313
)
1414
end
1515

16-
let(:legacy_parent_ids_doc) do
17-
SolrDocument.new(
18-
parent_ssim: %w[abc123 def ghi],
19-
parent_unittitles_ssm: %w[ABC123 DEF GHI],
20-
ead_ssi: 'abc123',
21-
_root_: 'abc123',
22-
parent_levels_ssm: %w[collection]
23-
)
24-
end
25-
2616
let(:dot_eadid_doc) do
2717
SolrDocument.new(
2818
parent_ids_ssim: %w[abc123-xml abc123-xml_def abc123-xml_ghi],
@@ -35,7 +25,6 @@
3525
let(:empty_document) { SolrDocument.new }
3626
let(:good_instance) { described_class.from_solr_document(document) }
3727
let(:dot_eadid_instance) { described_class.from_solr_document(dot_eadid_doc) }
38-
let(:legacy_parent_ids_instance) { described_class.from_solr_document(legacy_parent_ids_doc) }
3928

4029
describe '.from_solr_document' do
4130
context 'with good data' do
@@ -45,7 +34,6 @@
4534

4635
it 'values are appropriately set' do
4736
expect(good_instance.ids).to eq %w[abc123 abc123_def abc123_ghi]
48-
expect(good_instance.legacy_ids).to be_empty
4937
expect(good_instance.labels).to eq %w[ABC123 DEF GHI]
5038
expect(good_instance.eadid).to eq 'abc123'
5139
expect(good_instance.levels).to eq %w[collection]
@@ -56,13 +44,6 @@
5644
end
5745
end
5846

59-
context 'with legacy parent_ssim data' do
60-
it 'id values are appropriately set' do
61-
expect(legacy_parent_ids_instance.ids).to be_empty
62-
expect(legacy_parent_ids_instance.legacy_ids).to eq %w[abc123 abc123def abc123ghi]
63-
end
64-
end
65-
6647
context 'with no data' do
6748
it 'returns an instance of itself' do
6849
expect(described_class.from_solr_document(empty_document)).to be_an described_class
@@ -92,16 +73,9 @@
9273
end
9374
end
9475

95-
context 'with legacy parent_ssim data' do
96-
it 'the containing parents have the correct data' do
97-
expect(legacy_parent_ids_instance.as_parents.first.id).to eq 'abc123'
98-
expect(legacy_parent_ids_instance.as_parents.last.id).to eq 'abc123ghi'
99-
end
100-
end
101-
10276
context 'with no data' do
10377
it 'returns an empty array' do
104-
expect(described_class.new(ids: [], legacy_ids: [], labels: [], eadid: '', levels: '').as_parents).to eq []
78+
expect(described_class.new(ids: [], labels: [], eadid: '', levels: '').as_parents).to eq []
10579
end
10680
end
10781
end

spec/models/concerns/arclight/solr_document_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
let(:document) { SolrDocument.new(id: '123') }
77

88
describe 'custom accessors' do
9-
it { expect(document).to respond_to(:legacy_parent_ids) }
109
it { expect(document).to respond_to(:parent_ids) }
1110
it { expect(document).to respond_to(:parent_labels) }
1211
it { expect(document).to respond_to(:eadid) }

0 commit comments

Comments
 (0)