diff --git a/app/indexers/work_indexer.rb b/app/indexers/work_indexer.rb index 9442b999..de68565f 100644 --- a/app/indexers/work_indexer.rb +++ b/app/indexers/work_indexer.rb @@ -59,7 +59,7 @@ def related_record_title_markup(ursus_url, title) def add_dates(solr_doc) valid_dates = solr_dates solr_doc['date_dtsim'] = valid_dates if valid_dates - solr_doc['date_dtsort'] = solr_doc['date_dtsim'][0] if solr_doc['date_dtsort'] + solr_doc['date_dtsort'] = solr_doc['date_dtsim'][0] if solr_doc['date_dtsim'] end def combined_subject diff --git a/spec/indexers/work_indexer_spec.rb b/spec/indexers/work_indexer_spec.rb index eabab369..4f722279 100644 --- a/spec/indexers/work_indexer_spec.rb +++ b/spec/indexers/work_indexer_spec.rb @@ -303,6 +303,7 @@ it 'indexes the year' do expect(solr_document['year_isim']).to eq [1940] expect(solr_document['date_dtsim']).to eq [Date.strptime('1940', "%Y").to_time.utc.iso8601] + expect(solr_document['date_dtsort']).to eq '1940-01-01T00:00:00Z' end end @@ -345,6 +346,7 @@ it 'indexes the earliest year' do expect(solr_document['sort_year_isi']).to eq 1940 expect(solr_document['date_dtsim']).to eq [Date.strptime('1940-10-15', "%Y-%m-%d").to_time.utc.iso8601] + expect(solr_document['date_dtsort']).to eq '1940-10-15T00:00:00Z' end end @@ -372,6 +374,7 @@ it 'indexes the earliest year' do expect(solr_document['sort_year_isi']).to eq 1934 expect(solr_document['date_dtsim']).to eq [Date.strptime('1934-06', "%Y-%m").to_time.utc.iso8601, Date.strptime('1937-07', "%Y-%m").to_time.utc.iso8601] + expect(solr_document['date_dtsort']).to eq '1934-06-01T00:00:00Z' end end