Skip to content

Commit

Permalink
adding fields for searching for exhibits: pub_display and ref_type_ssm (
Browse files Browse the repository at this point in the history
#2597)

* adding fields to all search

* removing extra space

* adding ref_type_ssm to all_search, making pub_display and pub_search equivalent, removing copy field for pub_display

* adding ref_type_ssm to ref_type_search

* fixing syntax error

* changing to_field to plural when passing several strings

* updating reference type to copy to all_search

* populating only pub_search and relying on schema to copy to pub_display

* getting tests to pass for now

* updating approach to populate pub search, allow schema.org copying, and add ref_type_ssm to ref_type_ssmi
  • Loading branch information
hudajkhan authored Oct 8, 2024
1 parent 0266b1c commit 957404d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/traject/bibtex_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@
to_field 'ref_type_ssm', extract_bibtex(:type) do |_record, accumulator, _context|
accumulator.map! { |v| BIBTEX_ZOTERO_MAPPING[v] }.compact!
end
# Based on schema.xml, *_ssim fields are copied over to all_search
to_field 'ref_type_ssim', copy('ref_type_ssm')

to_fields %w(title_display title_uniform_search title_sort), extract_bibtex_field(:title)
to_fields %w(author_person_full_display author_sort author_1xx_search), extract_bibtex_field(:author)
to_fields %w(pub_year_isi pub_year_w_approx_isi), extract_bibtex(:year)
to_field 'editor_ssim', extract_bibtex_field(:editor)
to_field 'book_title_ssim', extract_bibtex_field(:booktitle)
to_field 'pub_display', extract_bibtex_field(:journal)
to_field 'pub_display', extract_bibtex_field(:publisher)
# Based on schema.xml, pub_search is also copied over to pub_display
to_field 'pub_search', extract_bibtex_field(:journal)
to_field 'pub_search', extract_bibtex_field(:publisher)
to_field 'location_ssi', extract_bibtex_field(:address)
to_field 'university_ssim', extract_bibtex_field(:school)
to_field 'edition_ssm', extract_bibtex_field(:edition)
Expand Down
1 change: 1 addition & 0 deletions lib/traject/dor_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
to_field 'url_suppl', stanford_mods(:term_values, [:related_item, :location, :url])

# publication fields
# Based on schema.xml, pub_search is also copied over to pub_display
to_field 'pub_search', stanford_mods(:place)
to_field 'pub_year_isi', stanford_mods(:pub_year_int, ignore_approximate: false) # for sorting
# these are for single value facet display (in lieu of date slider (pub_year_tisim) )
Expand Down
4 changes: 2 additions & 2 deletions spec/features/bibliography_resource_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

context 'article' do
it 'has publication title' do
expect(document['pub_display']).to eq ['Reinardus. Yearbook of the International Reynard Society']
expect(document['pub_search']).to eq ['Reinardus. Yearbook of the International Reynard Society']
end

it 'has a volume' do
Expand Down Expand Up @@ -110,7 +110,7 @@
let(:file) { 'spec/fixtures/bibliography/book.bib' }

it 'has a publisher' do
expect(document['pub_display']).to eq ['Faculdade de Letras da Universidade de Coimbra']
expect(document['pub_search']).to eq ['Faculdade de Letras da Universidade de Coimbra']
end

it 'has an edition' do
Expand Down

0 comments on commit 957404d

Please sign in to comment.