Skip to content

Commit

Permalink
Merge pull request #1444 from projectblacklight/1017-date-range-integers
Browse files Browse the repository at this point in the history
Index date range years as integers rather than strings. Closes #1017.
  • Loading branch information
randalldfloyd authored Dec 8, 2023
2 parents 7b74227 + c92992a commit 07ab982
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/arclight/traject/ead2_component_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
end
end

to_field 'date_range_ssim', extract_xpath('./did/unitdate/@normal', to_text: false) do |_record, accumulator|
to_field 'date_range_isim', extract_xpath('./did/unitdate/@normal', to_text: false) do |_record, accumulator|
range = Arclight::YearRange.new
next range.years if accumulator.blank?

Expand Down
2 changes: 1 addition & 1 deletion lib/arclight/traject/ead2_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
to_field 'extent_tesim', extract_xpath('/ead/archdesc/did/physdesc/extent')
to_field 'genreform_ssim', extract_xpath('/ead/archdesc/controlaccess/genreform')

to_field 'date_range_ssim', extract_xpath('/ead/archdesc/did/unitdate/@normal', to_text: false) do |_record, accumulator|
to_field 'date_range_isim', extract_xpath('/ead/archdesc/did/unitdate/@normal', to_text: false) do |_record, accumulator|
range = Arclight::YearRange.new
next range.years if accumulator.blank?

Expand Down
2 changes: 1 addition & 1 deletion lib/generators/arclight/templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class CatalogController < ApplicationController

config.add_facet_field 'collection', field: 'collection_ssim', limit: 10
config.add_facet_field 'creator', field: 'creator_ssim', limit: 10
config.add_facet_field 'date_range', field: 'date_range_ssim', range: true
config.add_facet_field 'date_range', field: 'date_range_isim', range: true
config.add_facet_field 'level', field: 'level_ssim', limit: 10
config.add_facet_field 'names', field: 'names_ssim', limit: 10
config.add_facet_field 'repository', field: 'repository_ssim', limit: 10
Expand Down
2 changes: 1 addition & 1 deletion solr/conf/solrconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
<str name="facet.mincount">1</str>
<str name="facet.field">level_ssim</str>
<str name="facet.field">creator_ssim</str>
<str name="facet.field">date_range_ssim</str>
<str name="facet.field">date_range_isim</str>
<str name="facet.field">names_ssim</str>
<str name="facet.field">geogname_ssim</str>
<str name="facet.field">access_subjects_ssim</str>
Expand Down
8 changes: 4 additions & 4 deletions spec/features/traject/ead2_indexing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def components(result)
expect(result['unitdate_other_ssim']).to be_nil
end

it 'creates date_range_ssim' do
date_range = result['date_range_ssim']
it 'creates date_range_isim' do
date_range = result['date_range_isim']
expect(date_range).to be_an Array
expect(date_range.length).to eq 7
expect(date_range.first).to eq 1900
Expand Down Expand Up @@ -541,9 +541,9 @@ def components(result)
Arclight::Engine.root.join('spec', 'fixtures', 'ead', 'nlm', 'alphaomegaalpha.xml')
end

it 'creates date_range_ssim' do
it 'creates date_range_isim' do
component = all_components.find { |d| d['id'] == ['aoa271aspace_563a320bb37d24a9e1e6f7bf95b52671'] }
date_range = component['date_range_ssim']
date_range = component['date_range_isim']
expect(date_range).to be_an Array
expect(date_range.length).to eq 75
expect(date_range.first).to eq 1902
Expand Down

0 comments on commit 07ab982

Please sign in to comment.