• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 0e37073d-109c-440c-949f-49d2aa86311b

18 Aug 2025 09:05PM UTC coverage: 0.482% (-94.9%) from 95.343%
0e37073d-109c-440c-949f-49d2aa86311b

push

circleci

web-flow
Replace per_page_options_for_select with custom component to avoid deprecation issue (#5186)

* Start creating new component to address deprecaton warning

* Replace per_page_options_for_select with custom component to avoid deprecation issue

Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

---------

Co-authored-by: Ryan Jensen <rj1044@princeton.edu>
Co-authored-by: Jane Sandberg <sandbergja@users.noreply.github.com>

0 of 33 new or added lines in 1 file covered. (0.0%)

9374 existing lines in 213 files now uncovered.

47 of 9753 relevant lines covered (0.48%)

0.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/controllers/catalog_controller.rb
1
# frozen_string_literal: false
2

UNCOV
3
class CatalogController < ApplicationController
×
UNCOV
4
  include Blacklight::Catalog
×
5

UNCOV
6
  include Blacklight::Marc::Catalog
×
UNCOV
7
  include BlacklightRangeLimit::ControllerOverride
×
UNCOV
8
  include Orangelight::Catalog
×
UNCOV
9
  include Orangelight::ExcessivePaging
×
UNCOV
10
  include BlacklightHelper
×
11

UNCOV
12
  before_action :redirect_browse
×
UNCOV
13
  before_action :deny_excessive_paging
×
14

UNCOV
15
  rescue_from Blacklight::Exceptions::RecordNotFound do
×
UNCOV
16
    alma_id = "99#{params[:id]}3506421"
×
UNCOV
17
    search_service.fetch(alma_id)
×
UNCOV
18
    redirect_to solr_document_path(id: alma_id)
×
UNCOV
19
  rescue Blacklight::Exceptions::RecordNotFound
×
UNCOV
20
    redirect_to '/404'
×
UNCOV
21
  end
×
22

UNCOV
23
  rescue_from ActionController::InvalidAuthenticityToken do
×
24
    redirect_to solr_document_path(params[:id])
×
UNCOV
25
  end
×
26

UNCOV
27
  rescue_from BlacklightRangeLimit::InvalidRange do
×
UNCOV
28
    redirect_to '/', flash: { error: 'The start year must be before the end year.' }
×
UNCOV
29
  end
×
30

UNCOV
31
  configure_blacklight do |config|
×
32
    # config.add_field_configuration_to_solr_request!
UNCOV
33
    config.raw_endpoint.enabled = true
×
34

UNCOV
35
    config.json_solr_path = 'advanced'
×
36

37
    # default advanced config values
UNCOV
38
    config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
×
UNCOV
39
    config.advanced_search[:url_key] ||= 'advanced'
×
UNCOV
40
    config.advanced_search[:query_parser] ||= 'edismax'
×
UNCOV
41
    config.advanced_search[:form_solr_parameters] ||= {}
×
UNCOV
42
    config.advanced_search[:form_solr_parameters]['facet.field'] ||= %w[access_facet format publication_place_hierarchical_facet language_facet original_language_of_translation_facet advanced_location_s]
×
UNCOV
43
    config.advanced_search[:form_solr_parameters]['facet.query'] ||= ''
×
UNCOV
44
    config.advanced_search[:form_solr_parameters]['facet.limit'] ||= -1
×
UNCOV
45
    config.advanced_search[:form_solr_parameters]['facet.pivot'] ||= ''
×
UNCOV
46
    config.advanced_search[:form_solr_parameters]['f.language_facet.facet.sort'] ||= 'index'
×
47
    # TODO: Remove non-pipe options after re-index with pipe delimiter
UNCOV
48
    config.advanced_search[:form_solr_parameters]['f.publication_place_hierarchical_facet.facet.sort'] ||= 'index'
×
UNCOV
49
    config.advanced_search[:form_solr_parameters]['f.publication_place_hierarchical_pipe_facet.facet.sort'] ||= 'index'
×
50

UNCOV
51
    config.numismatics_search ||= Blacklight::OpenStructWithHashAccess.new
×
UNCOV
52
    config.numismatics_search[:facet_fields] ||= %w[issue_metal_s issue_city_s issue_state_s issue_region_s issue_denomination_s
×
UNCOV
53
                                                    issue_ruler_s issue_artists_s find_place_s donor_s issue_object_type_s]
×
54

55
    ## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
56

57
    # solr path which will be added to solr base url before the other solr params.
58
    # config.solr_path = 'select'
59

60
    # items to show per page, each number in the array represent another option to choose from.
61
    # config.per_page = [10,20,50,100]
UNCOV
62
    config.default_per_page = 20
×
63

64
    ## Default parameters to send on single-document requests to Solr. These settings are the Blackligt defaults (see SolrHelper#solr_doc_params) or
65
    ## parameters included in the Blacklight-jetty document requestHandler.
66
    #
67

68
    # config.default_document_solr_params = {
69
    #  :qt => 'document',
70
    #  ## These are hard-coded in the blacklight 'document' requestHandler
71
    #  # :fl => '*',
72
    #  # :rows => 1
73
    #   :q => query
74
    # }
75

UNCOV
76
    config.add_show_tools_partial(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?)
×
UNCOV
77
    config.add_show_tools_partial(:email, callback: :email_action, validator: :validate_email_params)
×
UNCOV
78
    config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action, validator: :validate_sms_params)
×
UNCOV
79
    config.add_show_tools_partial(:citation)
×
80

UNCOV
81
    config.navbar.partials.delete(:search_history)
×
UNCOV
82
    config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark')
×
83

84
    # solr field configuration for search results/index views
UNCOV
85
    config.index.title_field = 'title_display'
×
UNCOV
86
    config.index.title_component = IndexTitleComponent
×
UNCOV
87
    config.index.document_component = IndexDocumentComponent
×
UNCOV
88
    config.index.display_type_field = 'format'
×
89

90
    # solr field configuration for document/show views
UNCOV
91
    config.show.partials = %i[show_identifiers show]
×
92
    # config.show.title_field = 'title_display'
93
    # config.show.display_type_field = 'format'
94

95
    # solr fields that will be treated as facets by the blacklight application
96
    #   The ordering of the field names is the order of the display
97
    #
98
    # Setting a limit will trigger Blacklight's 'more' facet values link.
99
    # * If left unset, then all facet values returned by solr will be displayed.
100
    # * If set to an integer, then "f.somefield.facet.limit" will be added to
101
    # solr request, with actual solr request being +1 your configured limit --
102
    # you configure the number of items you actually want _displayed_ in a page.
103
    # * If set to 'true', then no additional parameters will be sent to solr,
104
    # but any 'sniffed' request limit parameters will be used for paging, with
105
    # paging at requested limit -1. Can sniff from facet.limit or
106
    # f.specific_field.facet.limit solr request params. This 'true' config
107
    # can be used if you set limits in :default_solr_params, or as defaults
108
    # on the solr side in the request handler itself. Request handler defaults
109
    # sniffing requires solr requests to be made with "echoParams=all", for
110
    # app code to actually have it echo'd back to see it.
111
    #
112
    # :show may be set to false if you don't want the facet to be drawn in the
113
    # facet bar
114
    # The following fields are hidden from the facet bar and advanced search. They are used as a keyword search.
UNCOV
115
    config.add_facet_field 'lc_subject_facet', label: 'LC Subjects', limit: true, include_in_advanced_search: false, show: false
×
UNCOV
116
    config.add_facet_field 'lcgft_genre_facet', label: 'LC Genres', limit: true, include_in_advanced_search: false, show: false
×
UNCOV
117
    config.add_facet_field 'aat_genre_facet', label: 'Genres: Art and Architecture Thesaurus', limit: true, include_in_advanced_search: false, show: false
×
UNCOV
118
    config.add_facet_field 'homoit_genre_facet', label: 'Genres: Homosaurus', limit: true, include_in_advanced_search: false, show: false
×
UNCOV
119
    config.add_facet_field 'homoit_subject_facet', label: 'Subjects: Homosaurus', limit: true, include_in_advanced_search: false, show: false
×
UNCOV
120
    config.add_facet_field 'local_subject_facet', label: 'Subjects: Local', limit: true, include_in_advanced_search: false, show: false
×
UNCOV
121
    config.add_facet_field 'rbgenr_genre_facet', label: 'Genres: Rare Books', limit: true, include_in_advanced_search: false, show: false
×
UNCOV
122
    config.add_facet_field 'siku_subject_facet', label: 'Subjects: Siku', limit: true, include_in_advanced_search: false, show: false
×
123

UNCOV
124
    config.add_facet_field 'access_facet', label: 'Access', sort: 'index', collapse: false, home: true, include_in_advanced_search: true
×
UNCOV
125
    config.add_facet_field 'location', label: 'Library', limit: 20, sort: 'index',
×
UNCOV
126
                                       home: true, solr_params: { 'facet.mincount' => Blacklight.blacklight_yml['mincount'] || 1 }, include_in_advanced_search: false
×
UNCOV
127
    config.add_facet_field 'format', label: 'Format', item_component: FormatFacetItemComponent, sort: 'index', limit: 15,
×
UNCOV
128
                                     collapse: false, home: true, solr_params: { 'facet.mincount' => Blacklight.blacklight_yml['mincount'] || 1 }, include_in_advanced_search: true
×
129

130
    # num_segments and segments set to defaults here, included to show customizable features
UNCOV
131
    config.add_facet_field 'pub_date_start_sort', label: 'Publication year', single: true, range: true, range_config: {
×
UNCOV
132
      num_segments: 10,
×
UNCOV
133
      assumed_boundaries: [1100, Time.now.year + 1],
×
UNCOV
134
      segments: true,
×
UNCOV
135
      chart_segment_border_color: 'rgb(255, 217, 96)',
×
UNCOV
136
      chart_segment_bg_color: 'rgba(255, 217, 96, 0.5)',
×
UNCOV
137
      show_missing_link: false
×
UNCOV
138
    }
×
UNCOV
139
    config.add_facet_field 'language_facet', label: 'Language', limit: true, include_in_advanced_search: true, suggest: true
×
UNCOV
140
    config.add_facet_field 'original_language_of_translation_facet', label: 'Source language of translation', show: false, include_in_advanced_search: true
×
UNCOV
141
    config.add_facet_field 'subject_topic_facet', label: 'Subject: Topic', limit: true, include_in_advanced_search: false, suggest: true
×
UNCOV
142
    config.add_facet_field 'genre_facet', label: 'Subject: Genre', limit: true, include_in_advanced_search: false
×
UNCOV
143
    config.add_facet_field 'subject_era_facet', label: 'Subject: Era', limit: true, include_in_advanced_search: false
×
UNCOV
144
    config.add_facet_field 'geographic_facet', label: 'Subject: Geographic', limit: true, include_in_advanced_search: false
×
UNCOV
145
    config.add_facet_field 'recently_added_facet', label: 'Recently added', home: true, query: {
×
UNCOV
146
      weeks_1: { label: 'Within 1 week', fq: 'cataloged_tdt:[NOW/DAY-7DAYS TO NOW/DAY+1DAY]' },
×
UNCOV
147
      weeks_2: { label: 'Within 2 weeks', fq: 'cataloged_tdt:[NOW/DAY-14DAYS TO NOW/DAY+1DAY]' },
×
UNCOV
148
      weeks_3: { label: 'Within 3 weeks', fq: 'cataloged_tdt:[NOW/DAY-21DAYS TO NOW/DAY+1DAY]' },
×
UNCOV
149
      months_1: { label: 'Within 1 month', fq: 'cataloged_tdt:[NOW/DAY-1MONTH TO NOW/DAY+1DAY]' },
×
UNCOV
150
      months_2: { label: 'Within 2 months', fq: 'cataloged_tdt:[NOW/DAY-2MONTHS TO NOW/DAY+1DAY]' },
×
UNCOV
151
      months_3: { label: 'Within 3 months', fq: 'cataloged_tdt:[NOW/DAY-3MONTHS TO NOW/DAY+1DAY]' },
×
UNCOV
152
      months_6: { label: 'Within 6 months', fq: 'cataloged_tdt:[NOW/DAY-6MONTHS TO NOW/DAY+1DAY]' }
×
UNCOV
153
    }, include_in_advanced_search: false
×
154

UNCOV
155
    config.add_facet_field 'instrumentation_facet', label: 'Instrumentation', limit: true, include_in_advanced_search: false
×
UNCOV
156
    config.add_facet_field 'publication_place_hierarchical_pipe_facet', label: 'Place of publication', component: Blacklight::Hierarchy::FacetFieldListComponent, sort: 'index', limit: 1000, include_in_advanced_search: true, unless: ->(_controller, _config, _field) { Flipflop.blacklight_hierarchy_publication_facet? }
×
157
    # TODO: Remove non-pipe options after re-index with pipe delimiter
UNCOV
158
    config.add_facet_field 'publication_place_hierarchical_facet', label: 'Place of publication', component: Blacklight::Hierarchy::FacetFieldListComponent, sort: 'index', limit: 1000, include_in_advanced_search: true, if: ->(_controller, _config, _field) { Flipflop.blacklight_hierarchy_publication_facet? }
×
UNCOV
159
    config.add_facet_field 'lc_pipe_facet', label: 'Classification', component: Blacklight::Hierarchy::FacetFieldListComponent, sort: 'index', limit: 1000, include_in_advanced_search: false, unless: ->(_controller, _config, _field) { Flipflop.blacklight_hierarchy_facet? }
×
160
    # TODO: Remove non-pipe options after re-index with pipe delimiter
UNCOV
161
    config.add_facet_field 'lc_facet', label: 'Classification', component: Blacklight::Hierarchy::FacetFieldListComponent, sort: 'index', limit: 1000, include_in_advanced_search: false, if: ->(_controller, _config, _field) { Flipflop.blacklight_hierarchy_facet? }
×
162

UNCOV
163
    config.add_facet_field 'lc_1letter_facet', label: 'Classification', limit: 25, include_in_request: false, sort: 'index'
×
UNCOV
164
    config.add_facet_field 'lc_rest_facet', label: 'Full call number code', limit: 25, include_in_request: false, sort: 'index'
×
UNCOV
165
    config.add_facet_field 'sudoc_facet', label: 'SuDocs', limit: true, sort: 'index', include_in_advanced_search: false
×
166

167
    # The following facet configurations are purely for display purposes. They
168
    # will not show up in the facet bar, but without them the labels and other
169
    # configuration which show up when a user clicks that field in the show page
170
    # will be wrong.
UNCOV
171
    config.add_facet_field 'author_s', label: 'Author', limit: true, include_in_request: false
×
UNCOV
172
    config.add_facet_field 'class_year_s', label: 'PU class year', limit: true, include_in_request: false
×
UNCOV
173
    config.add_facet_field 'call_number_browse_s', label: 'Call number', include_in_request: false
×
174

UNCOV
175
    config.add_facet_field 'call_number_scheme_facet', label: 'Call number scheme', limit: 25, include_in_request: false, sort: 'index'
×
UNCOV
176
    config.add_facet_field 'call_number_group_facet', label: 'Call number group', limit: 25, include_in_request: false, sort: 'index'
×
UNCOV
177
    config.add_facet_field 'call_number_full_facet', label: 'Full call number', limit: 25, include_in_request: false, sort: 'index'
×
UNCOV
178
    config.add_facet_field 'advanced_location_s', label: 'Holding location', include_in_request: true, show: false,
×
UNCOV
179
                                                  helper_method: :render_location_code, include_in_advanced_search: true, sort: 'alpha'
×
UNCOV
180
    config.add_facet_field 'name_title_browse_s', label: 'Author-title heading', include_in_request: false
×
UNCOV
181
    config.add_facet_field 'subject_facet', show: false, include_in_advanced_search: false
×
182

183
    # Numismatics facets
UNCOV
184
    config.add_facet_field 'numismatic_collection_s', label: 'Numismatic Collection', include_in_request: false
×
UNCOV
185
    config.add_facet_field 'issue_date_s', label: 'Date', include_in_request: false
×
UNCOV
186
    config.add_facet_field 'issue_artists_s', label: 'Artist', include_in_request: false
×
UNCOV
187
    config.add_facet_field 'issue_subject_s', label: 'Subject', include_in_request: false
×
UNCOV
188
    config.add_facet_field 'numismatic_accession_s', label: 'Accession', include_in_request: false
×
UNCOV
189
    config.add_facet_field 'numismatic_provenance_s', label: 'Provenance', include_in_request: false
×
UNCOV
190
    config.add_facet_field 'issue_number_s', label: 'Issue', include_in_request: false
×
UNCOV
191
    config.add_facet_field 'issue_monogram_title_s', label: 'Monogram', include_in_request: false
×
UNCOV
192
    config.add_facet_field 'issue_citations_s', label: 'Citations', include_in_request: false
×
UNCOV
193
    config.add_facet_field 'issue_references_s', label: 'References', include_in_request: false
×
UNCOV
194
    config.add_facet_field 'donor_s', label: 'Donor', include_in_request: false
×
UNCOV
195
    config.add_facet_field 'analysis_s', label: 'Analysis', include_in_request: false
×
UNCOV
196
    config.add_facet_field 'counter_stamp_s', label: 'Counter Stamp', include_in_request: false
×
UNCOV
197
    config.add_facet_field 'die_axis_s', label: 'Die Axis', include_in_request: false
×
UNCOV
198
    config.add_facet_field 'find_date_s', label: 'Find Date', include_in_request: false
×
UNCOV
199
    config.add_facet_field 'find_description_s', label: 'Find Description', include_in_request: false
×
UNCOV
200
    config.add_facet_field 'find_feature_s', label: 'Find Feature', include_in_request: false
×
UNCOV
201
    config.add_facet_field 'find_locus_s', label: 'Find Locus', include_in_request: false
×
UNCOV
202
    config.add_facet_field 'find_number_s', label: 'Find Number', include_in_request: false
×
UNCOV
203
    config.add_facet_field 'find_place_s', label: 'Find Place', include_in_request: false
×
UNCOV
204
    config.add_facet_field 'issue_color_s', label: 'Color', include_in_request: false
×
UNCOV
205
    config.add_facet_field 'issue_denomination_s', label: 'Denomination', include_in_request: false
×
UNCOV
206
    config.add_facet_field 'issue_edge_s', label: 'Edge', include_in_request: false
×
UNCOV
207
    config.add_facet_field 'issue_era_s', label: 'Era', include_in_request: false
×
UNCOV
208
    config.add_facet_field 'issue_master_s', label: 'Master', include_in_request: false
×
UNCOV
209
    config.add_facet_field 'issue_metal_s', label: 'Metal', include_in_request: false
×
UNCOV
210
    config.add_facet_field 'issue_city_s', label: 'City', include_in_request: false
×
UNCOV
211
    config.add_facet_field 'issue_state_s', label: 'State', include_in_request: false
×
UNCOV
212
    config.add_facet_field 'issue_region_s', label: 'Region', include_in_request: false
×
UNCOV
213
    config.add_facet_field 'issue_object_type_s', label: 'Object Type', include_in_request: false
×
UNCOV
214
    config.add_facet_field 'issue_obverse_attributes_s', label: 'Obverse Attributes', include_in_request: false
×
UNCOV
215
    config.add_facet_field 'issue_obverse_figure_description_s', label: 'Obverse Figure Description', include_in_request: false
×
UNCOV
216
    config.add_facet_field 'issue_obverse_figure_relationship_s', label: 'Obverse Figure Relationship', include_in_request: false
×
UNCOV
217
    config.add_facet_field 'issue_obverse_figure_s', label: 'Obverse Figure', include_in_request: false
×
UNCOV
218
    config.add_facet_field 'issue_obverse_legend_s', label: 'Obverse Legend', include_in_request: false
×
UNCOV
219
    config.add_facet_field 'issue_obverse_orientation_s', label: 'Obverse Orientation', include_in_request: false
×
UNCOV
220
    config.add_facet_field 'issue_obverse_part_s', label: 'Obverse Part', include_in_request: false
×
UNCOV
221
    config.add_facet_field 'issue_obverse_symbol_s', label: 'Obverse Symbol', include_in_request: false
×
UNCOV
222
    config.add_facet_field 'issue_reverse_attributes_s', label: 'Reverse Attributes', include_in_request: false
×
UNCOV
223
    config.add_facet_field 'issue_reverse_figure_description_s', label: 'Reverse Figure Description', include_in_request: false
×
UNCOV
224
    config.add_facet_field 'issue_reverse_figure_relationship_s', label: 'Reverse Figure Relationship', include_in_request: false
×
UNCOV
225
    config.add_facet_field 'issue_reverse_figure_s', label: 'Reverse Figure', include_in_request: false
×
UNCOV
226
    config.add_facet_field 'issue_reverse_legend_s', label: 'Reverse Legend', include_in_request: false
×
UNCOV
227
    config.add_facet_field 'issue_reverse_orientation_s', label: 'Reverse Orientation', include_in_request: false
×
UNCOV
228
    config.add_facet_field 'issue_reverse_part_s', label: 'Reverse Part', include_in_request: false
×
UNCOV
229
    config.add_facet_field 'issue_reverse_symbol_s', label: 'Reverse Symbol', include_in_request: false
×
UNCOV
230
    config.add_facet_field 'issue_ruler_s', label: 'Ruler', include_in_request: false
×
UNCOV
231
    config.add_facet_field 'issue_series_s', label: 'Series', include_in_request: false
×
UNCOV
232
    config.add_facet_field 'issue_shape_s', label: 'Shape', include_in_request: false
×
UNCOV
233
    config.add_facet_field 'issue_workshop_s', label: 'Workshop', include_in_request: false
×
UNCOV
234
    config.add_facet_field 'size_s', label: 'Size', include_in_request: false
×
UNCOV
235
    config.add_facet_field 'technique_s', label: 'Technique', include_in_request: false
×
UNCOV
236
    config.add_facet_field 'weight_s', label: 'Weight', include_in_request: false
×
UNCOV
237
    config.add_facet_field 'coin_citations_s', label: 'Citations', include_in_request: false
×
UNCOV
238
    config.add_facet_field 'coin_references_s', label: 'References', include_in_request: false
×
239

240
    # Have BL send all facet field names to Solr, which has been the default
241
    # previously. Simply remove these lines if you'd rather use Solr request
242
    # handler defaults, or have no facets.
UNCOV
243
    config.add_facet_fields_to_solr_request!
×
244

245
    # Config for hierarchy options
246
    # TODO: Remove non-pipe options after re-index with pipe delimiter
UNCOV
247
    config.facet_display = {
×
UNCOV
248
      hierarchy: {
×
UNCOV
249
        'lc' => [['facet'], ':'],
×
UNCOV
250
        'lc_pipe' => [['facet'], '|||'],
×
UNCOV
251
        'publication_place_hierarchical' => [['facet'], ':'],
×
UNCOV
252
        'publication_place_hierarchical_pipe' => [['facet'], '|||']
×
UNCOV
253
      }
×
UNCOV
254
    }
×
255

256
    # solr fields to be displayed in the index (search results) view
257
    #   The ordering of the field names is the order of the display
258
    # NOTE: Most of these are added with show: false so they show up in the JSON
259
    #   output for bento search. If you need to add a field to JSON display
260
    #   (catalog.json), add it here!
UNCOV
261
    config.add_index_field 'series_display', label: 'Series', helper_method: :series_results
×
UNCOV
262
    config.add_index_field 'author_display', label: 'Author/Artist', browse_link: :name, presenter: Orangelight::HighlightPresenter
×
UNCOV
263
    config.add_index_field 'pub_created_display', label: 'Published/Created'
×
UNCOV
264
    config.add_index_field 'format', label: 'Format', component: FormatBadgeFieldComponent
×
UNCOV
265
    config.add_index_field 'holdings_1display', if: :json_request?
×
UNCOV
266
    config.add_index_field 'contained_in_s', if: :json_request?
×
UNCOV
267
    config.add_index_field 'isbn_t', if: :json_request?
×
UNCOV
268
    config.add_index_field 'score', if: :json_request?
×
UNCOV
269
    config.add_index_field 'marc_relator_display', if: :json_request?
×
UNCOV
270
    config.add_index_field 'title_display', if: :json_request?, presenter: Orangelight::HighlightPresenter
×
UNCOV
271
    config.add_index_field 'title_vern_display', if: :json_request?, presenter: Orangelight::HighlightPresenter
×
UNCOV
272
    config.add_index_field 'isbn_s', if: :json_request?
×
UNCOV
273
    config.add_index_field 'oclc_s', if: :json_request?
×
UNCOV
274
    config.add_index_field 'lccn_s', if: :json_request?
×
UNCOV
275
    config.add_index_field 'electronic_access_1display', if: :json_request?
×
UNCOV
276
    config.add_index_field 'cataloged_tdt', if: :json_request?
×
UNCOV
277
    config.add_index_field 'electronic_portfolio_s', if: :json_request?
×
UNCOV
278
    config.add_index_field 'lc_subject_display', label: 'Subjects', browse_link: :name, presenter: Orangelight::HighlightPresenter
×
UNCOV
279
    config.add_index_field 'siku_subject_display', if: false, presenter: Orangelight::HighlightPresenter
×
UNCOV
280
    config.add_index_field 'homoit_subject_display', if: false, presenter: Orangelight::HighlightPresenter
×
UNCOV
281
    config.add_index_field 'lcgft_s', if: false, presenter: Orangelight::HighlightPresenter
×
UNCOV
282
    config.add_index_field 'homoit_genre_s', if: false, presenter: Orangelight::HighlightPresenter
×
UNCOV
283
    config.add_index_field 'rbgenr_s', if: false, presenter: Orangelight::HighlightPresenter
×
UNCOV
284
    config.add_index_field 'aat_s', if: false, presenter: Orangelight::HighlightPresenter
×
UNCOV
285
    config.add_index_field 'notes_display', label: 'Notes', presenter: Orangelight::HighlightPresenter
×
286

287
    # solr fields to be displayed in the show (single result) view
288
    #   The ordering of the field names is the order of the display
289
    # config.add_show_field 'title_display', :label => 'Title'
290
    # config.add_show_field 'title_vern_display', :label => 'Title'
291
    # config.add_show_field 'subtitle_display', :label => 'Subtitle'
292
    # config.add_show_field 'subtitle_vern_display', :label => 'Subtitle'
293

294
    # Top fields in show page / prioritized information
295
    # Top fields must include `if: false`, or they will be duplicated in the Details section
296
    # They should be designated with either `default_top_field: true`, `coin_top_field: true` or both
UNCOV
297
    config.add_show_field 'author_display', label: "Author/\u200BArtist", browse_link: :name, if: false, default_top_field: true
×
298
    # For uniform titles from 240 field - when there is both an author and uniform title
UNCOV
299
    config.add_show_field 'name_uniform_title_1display', label: 'Uniform title', helper_method: :name_title_hierarchy, if: false, default_top_field: true
×
300
    # For uniform titles from 130 field - when there is only a uniform title, and no author
UNCOV
301
    config.add_show_field 'uniform_title_1display', label: 'Uniform title', helper_method: :title_hierarchy, if: false, default_top_field: true
×
UNCOV
302
    config.add_show_field 'format', label: 'Format', helper_method: :format_render, if: false, coin_top_field: true, default_top_field: true
×
UNCOV
303
    config.add_show_field 'language_name_display', label: 'Language', if: false, default_top_field: true
×
UNCOV
304
    config.add_show_field 'original_language_of_translation_facet', label: 'Translated from', if: false, default_top_field: true
×
UNCOV
305
    config.add_show_field 'edition_display', label: 'Εdition', if: false, default_top_field: true
×
UNCOV
306
    config.add_show_field 'pub_created_display', label: "Published/\u200BCreated", if: false, default_top_field: true
×
UNCOV
307
    config.add_show_field 'description_display', label: 'Description', if: false, default_top_field: true
×
308

309
    # Senior Thesis linked fields
UNCOV
310
    config.add_show_field 'advisor_display', label: 'Advisor(s)', browse_link: :name
×
UNCOV
311
    config.add_show_field 'contributor_display', label: 'Contributor(s)', browse_link: :name
×
UNCOV
312
    config.add_show_field 'department_display', label: 'Department', browse_link: :name
×
UNCOV
313
    config.add_show_field 'certificate_display', label: 'Certificate', browse_link: :name
×
314

UNCOV
315
    config.add_show_field 'class_year_s', label: 'Class year', link_to_search_value: true
×
316
    # Linked fields pushed to top of supplemental info
UNCOV
317
    config.add_show_field 'lc_subject_display', label: 'Subject(s)', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
318
    config.add_show_field 'siku_subject_display', label: 'Chinese traditional subject(s)', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
319
    config.add_show_field 'homoit_subject_display', label: 'Homosaurus term(s)', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
320
    config.add_show_field 'homoit_genre_s', label: 'Homosaurus genre(s)', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
321
    config.add_show_field 'related_name_json_1display', hash: true
×
UNCOV
322
    config.add_show_field 'lcgft_s', label: 'Library of Congress genre(s)', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
323
    config.add_show_field 'rbgenr_s', label: 'Rare books genre', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
324
    config.add_show_field 'aat_s', label: 'Getty AAT genre', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
325
    config.add_show_field 'local_subject_display', label: 'Local Subjects', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
326
    config.add_show_field 'fast_subject_display', label: 'FaST Subject(s)', component: Orangelight::ProcessVocabularyComponent
×
UNCOV
327
    config.add_show_field 'related_works_1display', label: 'Related work(s)', helper_method: :name_title_hierarchy
×
UNCOV
328
    config.add_show_field 'series_display', label: 'Series', series_link: true
×
UNCOV
329
    config.add_show_field 'contains_1display', label: 'Contains', helper_method: :name_title_hierarchy
×
UNCOV
330
    config.add_show_field 'data_source_display', label: 'Data source', browse_link: :name_title
×
UNCOV
331
    config.add_show_field 'contained_in_s', label: 'Contained in', link_field: 'id'
×
UNCOV
332
    config.add_show_field 'related_record_s', label: 'Related record(s)', link_field: 'id'
×
UNCOV
333
    config.add_show_field 'other_editions_s', label: 'Other available editions', link_field: 'id'
×
UNCOV
334
    config.add_show_field 'translation_of_display', label: 'Translation of', browse_link: :name_title
×
UNCOV
335
    config.add_show_field 'translated_as_display', label: 'Translated as', browse_link: :name_title
×
UNCOV
336
    config.add_show_field 'issued_with_display', label: 'Issued with', browse_link: :name_title
×
UNCOV
337
    config.add_show_field 'continues_display', label: 'Continues', browse_link: :name_title
×
UNCOV
338
    config.add_show_field 'continues_in_part_display', label: 'Continues in part', browse_link: :name_title
×
UNCOV
339
    config.add_show_field 'formed_from_display', label: 'Formed from', browse_link: :name_title
×
UNCOV
340
    config.add_show_field 'absorbed_display', label: 'Absorbed', browse_link: :name_title
×
UNCOV
341
    config.add_show_field 'absorbed_in_part_display', label: 'Absorbed in part', browse_link: :name_title
×
UNCOV
342
    config.add_show_field 'separated_from_display', label: 'Separated from', browse_link: :name_title
×
UNCOV
343
    config.add_show_field 'continued_by_display', label: 'Continued by', browse_link: :name_title
×
UNCOV
344
    config.add_show_field 'continued_in_part_by_display', label: 'Continued in part by', browse_link: :name_title
×
UNCOV
345
    config.add_show_field 'absorbed_by_display', label: 'Absorbed by', browse_link: :name_title
×
UNCOV
346
    config.add_show_field 'absorbed_in_part_by_display', label: 'Absorbed in part by', browse_link: :name_title
×
UNCOV
347
    config.add_show_field 'split_into_display', label: 'Split into', browse_link: :name_title
×
UNCOV
348
    config.add_show_field 'merged_to_form_display', label: 'Merged to form', browse_link: :name_title
×
UNCOV
349
    config.add_show_field 'changed_back_to_display', label: 'Changed back to', browse_link: :name_title
×
UNCOV
350
    config.add_show_field 'subseries_of_display', label: 'Subseries of', browse_link: :name_title
×
UNCOV
351
    config.add_show_field 'has_subseries_display', label: 'Has subseries', browse_link: :name_title
×
UNCOV
352
    config.add_show_field 'has_supplement_display', label: 'Has supplement', browse_link: :name_title
×
UNCOV
353
    config.add_show_field 'supplement_to_display', label: 'Supplement to', browse_link: :name_title
×
354

355
    # Fields that are not links
UNCOV
356
    config.add_show_field 'url_fulltext_display', label: 'URL'
×
UNCOV
357
    config.add_show_field 'url_suppl_display', label: 'More information'
×
UNCOV
358
    config.add_show_field 'compiled_created_display', label: "Compiled/\u200BCreated"
×
UNCOV
359
    config.add_show_field 'medium_support_display', label: "Medium/\u200BSupport"
×
UNCOV
360
    config.add_show_field 'numbering_pec_notes_display', label: 'Numbering peculiarities'
×
UNCOV
361
    config.add_show_field 'arrangement_display', label: 'Arrangement'
×
UNCOV
362
    config.add_show_field 'frequency_display', label: 'Frequency'
×
UNCOV
363
    config.add_show_field 'former_frequency_display', label: 'Former frequency'
×
UNCOV
364
    config.add_show_field 'linking_notes_display', label: 'Linking notes'
×
UNCOV
365
    config.add_show_field 'restrictions_note_display', label: 'Restrictions note', mark_as_safe: true
×
UNCOV
366
    config.add_show_field 'biographical_historical_note_display', label: "Biographical/\u200BHistorical note"
×
UNCOV
367
    config.add_show_field 'summary_note_display', label: 'Summary note'
×
UNCOV
368
    config.add_show_field 'content_advice_display', label: 'Content advice'
×
UNCOV
369
    config.add_show_field 'notes_display', label: 'Notes'
×
UNCOV
370
    config.add_show_field 'holdings_1display', label: 'Location has', if: :online_holding_note?, helper_method: :location_has
×
UNCOV
371
    config.add_show_field 'with_notes_display', label: 'With'
×
UNCOV
372
    config.add_show_field 'bibliographic_notes_display', label: 'Bibliographic history'
×
UNCOV
373
    config.add_show_field 'dissertation_notes_display', label: 'Dissertation note'
×
UNCOV
374
    config.add_show_field 'bib_ref_notes_display', label: 'Bibliographic references'
×
UNCOV
375
    config.add_show_field 'scale_notes_display', label: 'Scale'
×
UNCOV
376
    config.add_show_field 'credits_notes_display', label: "Creation/\u200BProduction credits"
×
UNCOV
377
    config.add_show_field 'type_period_notes_display', label: 'Type of report and period covered'
×
UNCOV
378
    config.add_show_field 'data_quality_notes_display', label: 'Data quality'
×
UNCOV
379
    config.add_show_field 'type_comp_data_notes_display', label: 'Type of data'
×
UNCOV
380
    config.add_show_field 'date_place_event_notes_display', label: 'Time and place of event'
×
UNCOV
381
    config.add_show_field 'target_aud_notes_display', label: 'Target audience'
×
UNCOV
382
    config.add_show_field 'geo_cov_notes_display', label: 'Geographic coverage'
×
UNCOV
383
    config.add_show_field 'time_period_notes_display', label: 'Time period of content'
×
UNCOV
384
    config.add_show_field 'supplement_notes_display', label: 'Supplement note'
×
UNCOV
385
    config.add_show_field 'study_prog_notes_display', label: 'Study program information'
×
UNCOV
386
    config.add_show_field 'censorship_notes_display', label: 'Censorship note'
×
UNCOV
387
    config.add_show_field 'reproduction_notes_display', label: 'Reproduction note'
×
UNCOV
388
    config.add_show_field 'original_version_notes_display', label: 'Original version'
×
UNCOV
389
    config.add_show_field 'location_originals_notes_display', label: 'Location of originals'
×
UNCOV
390
    config.add_show_field 'funding_info_notes_display', label: 'Funding information'
×
UNCOV
391
    config.add_show_field 'source_data_notes_display', label: 'Source of data'
×
UNCOV
392
    config.add_show_field 'system_details_notes_display', label: 'System details'
×
UNCOV
393
    config.add_show_field 'related_copyright_notes_display', label: 'Copyright note'
×
UNCOV
394
    config.add_show_field 'location_other_arch_notes_display', label: 'Location of other archival materials'
×
UNCOV
395
    config.add_show_field 'former_title_complex_notes_display', label: 'Former title complexity'
×
UNCOV
396
    config.add_show_field 'issuing_body_notes_display', label: 'Issuing body'
×
UNCOV
397
    config.add_show_field 'info_document_notes_display', label: 'Information about documentation'
×
UNCOV
398
    config.add_show_field 'copy_version_notes_display', label: 'Copy and version identification'
×
UNCOV
399
    config.add_show_field 'case_file_notes_display', label: 'Case file characteristics'
×
UNCOV
400
    config.add_show_field 'methodology_notes_display', label: 'Methodology note'
×
UNCOV
401
    config.add_show_field 'editor_notes_display', label: 'Editor note'
×
UNCOV
402
    config.add_show_field 'action_notes_1display', label: 'Action note', helper_method: :action_notes_display
×
UNCOV
403
    config.add_show_field 'accumulation_notes_display', label: 'Accumulation and frequency of use'
×
UNCOV
404
    config.add_show_field 'awards_notes_display', label: 'Awards'
×
UNCOV
405
    config.add_show_field 'source_desc_notes_display', label: 'Source of description'
×
UNCOV
406
    config.add_show_field 'binding_note_display', label: 'Binding note'
×
UNCOV
407
    config.add_show_field 'local_notes_display', label: 'Local notes'
×
UNCOV
408
    config.add_show_field 'rights_reproductions_note_display', label: 'Rights and reproductions note', mark_as_safe: true
×
UNCOV
409
    config.add_show_field 'exhibitions_note_display', label: 'Exhibitions note'
×
UNCOV
410
    config.add_show_field 'participant_performer_display', label: "Participant(s)/\u200BPerformer(s)"
×
UNCOV
411
    config.add_show_field 'language_display', label: 'Language note'
×
UNCOV
412
    config.add_show_field 'script_display', label: 'Script'
×
UNCOV
413
    config.add_show_field 'contents_display', label: 'Contents', component: DisplayMoreFieldComponent, maxInitialDisplay: 3
×
UNCOV
414
    config.add_show_field 'incomplete_contents_display', label: 'Incomplete contents'
×
UNCOV
415
    config.add_show_field 'partial_contents_display', label: 'Partial contents'
×
UNCOV
416
    config.add_show_field 'provenance_display', label: 'Provenance'
×
UNCOV
417
    config.add_show_field 'source_acquisition_display', label: 'Source acquisition'
×
UNCOV
418
    config.add_show_field 'publications_about_display', label: 'Publications about'
×
UNCOV
419
    config.add_show_field 'indexed_in_display', label: 'Indexed in'
×
UNCOV
420
    config.add_show_field 'references_url_display', label: 'References', references_url: true
×
UNCOV
421
    config.add_show_field 'cite_as_display', label: 'Cite as'
×
UNCOV
422
    config.add_show_field 'other_format_display', label: 'Other format(s)'
×
UNCOV
423
    config.add_show_field 'indexes_display', label: 'Indexes'
×
UNCOV
424
    config.add_show_field 'finding_aid_display', label: 'Finding aid'
×
UNCOV
425
    config.add_show_field 'cumulative_index_finding_aid_display', label: "Cumulative index/\u200BFinding aid"
×
426

UNCOV
427
    config.add_show_field 'place_name_display', label: 'Place name(s)'
×
UNCOV
428
    config.add_show_field 'other_title_display', label: 'Other title(s)'
×
UNCOV
429
    config.add_show_field 'other_title_1display', hash: true
×
UNCOV
430
    config.add_show_field 'in_display', label: 'In'
×
UNCOV
431
    config.add_show_field 'other_editions_display', label: 'Other editions'
×
UNCOV
432
    config.add_show_field 'isbn_display', label: 'ISBN'
×
UNCOV
433
    config.add_show_field 'issn_display', label: 'ISSN'
×
UNCOV
434
    config.add_show_field 'sudoc_no_display', label: 'SuDoc no.'
×
UNCOV
435
    config.add_show_field 'tech_report_no_display', label: 'Tech. report no.'
×
UNCOV
436
    config.add_show_field 'publisher_no_display', label: 'Publisher no.'
×
UNCOV
437
    config.add_show_field 'lccn_display', label: 'LCCN'
×
UNCOV
438
    config.add_show_field 'oclc_s', label: 'OCLC'
×
UNCOV
439
    config.add_show_field 'coden_display', label: 'Coden designation'
×
UNCOV
440
    config.add_show_field 'standard_no_1display', hash: true
×
UNCOV
441
    config.add_show_field 'original_language_display', label: 'Original language'
×
UNCOV
442
    config.add_show_field 'recap_notes_display', label: 'RCP'
×
443

444
    # Numismatics fields
445
    ## Issue Description
UNCOV
446
    config.add_show_field 'numismatic_collection_s', label: 'Numismatic Collection', link_to_search_value: true, if: false, coin_top_field: true
×
UNCOV
447
    config.add_show_field 'issue_number_s', label: 'Issue', link_to_search_value: true, if: false, coin_top_field: true
×
UNCOV
448
    config.add_show_field 'issue_object_type_s', label: 'Object Type', link_to_search_value: true
×
UNCOV
449
    config.add_show_field 'issue_denomination_s', label: 'Denomination', link_to_search_value: true
×
UNCOV
450
    config.add_show_field 'issue_metal_s', label: 'Metal', link_to_search_value: true
×
UNCOV
451
    config.add_show_field 'issue_region_s', label: 'Region', link_to_search_value: true
×
UNCOV
452
    config.add_show_field 'issue_state_s', label: 'State', link_to_search_value: true
×
UNCOV
453
    config.add_show_field 'issue_city_s', label: 'City', link_to_search_value: true
×
UNCOV
454
    config.add_show_field 'issue_ruler_s', label: 'Ruler', link_to_search_value: true
×
UNCOV
455
    config.add_show_field 'issue_date_s', label: 'Date', link_to_search_value: true
×
UNCOV
456
    config.add_show_field 'issue_obverse_description_s', label: 'Obverse Figure Description', link_to_search_value: true
×
UNCOV
457
    config.add_show_field 'issue_obverse_legend_s', label: 'Obverse Legend', link_to_search_value: true
×
UNCOV
458
    config.add_show_field 'issue_obverse_attributes_s', label: 'Obverse Attributes', link_to_search_value: true
×
UNCOV
459
    config.add_show_field 'issue_obverse_figure_relationship_s', label: 'Obverse Figure Relationship', link_to_search_value: true
×
UNCOV
460
    config.add_show_field 'issue_obverse_symbol_s', label: 'Obverse Symbol', link_to_search_value: true
×
UNCOV
461
    config.add_show_field 'issue_reverse_description_s', label: 'Reverse Figure Description', link_to_search_value: true
×
UNCOV
462
    config.add_show_field 'issue_reverse_legend_s', label: 'Reverse Legend', link_to_search_value: true
×
UNCOV
463
    config.add_show_field 'issue_reverse_attributes_s', label: 'Reverse Attributes', link_to_search_value: true
×
UNCOV
464
    config.add_show_field 'issue_reverse_figure_relationship_s', label: 'Reverse Figure Relationship', link_to_search_value: true
×
UNCOV
465
    config.add_show_field 'issue_reverse_symbol_s', label: 'Reverse Symbol', link_to_search_value: true
×
UNCOV
466
    config.add_show_field 'issue_era_s', label: 'Era', link_to_search_value: true
×
UNCOV
467
    config.add_show_field 'issue_master_s', label: 'Master', link_to_search_value: true
×
UNCOV
468
    config.add_show_field 'issue_workshop_s', label: 'Workshop', link_to_search_value: true
×
UNCOV
469
    config.add_show_field 'issue_series_s', label: 'Series', link_to_search_value: true
×
UNCOV
470
    config.add_show_field 'issue_artists_s', label: 'Artist', link_to_search_value: true
×
UNCOV
471
    config.add_show_field 'issue_subject_s', label: 'Subject', link_to_search_value: true
×
UNCOV
472
    config.add_show_field 'issue_citations_s', label: 'Citations', link_to_search_value: true
×
UNCOV
473
    config.add_show_field 'issue_references_s', label: 'References', link_to_search_value: true
×
474

475
    ## Coin Description
UNCOV
476
    config.add_show_field 'size_s', label: 'Size', link_to_facet: true, coin_description: true
×
UNCOV
477
    config.add_show_field 'die_axis_s', label: 'Die Axis', link_to_facet: true, coin_description: true
×
UNCOV
478
    config.add_show_field 'weight_s', label: 'Weight', link_to_facet: true, coin_description: true
×
UNCOV
479
    config.add_show_field 'numismatic_accession_s', label: 'Accession', link_to_facet: true, coin_description: true
×
UNCOV
480
    config.add_show_field 'find_place_s', label: 'Find Place', link_to_facet: true, coin_description: true
×
UNCOV
481
    config.add_show_field 'find_number_s', label: 'Find Number', link_to_facet: true, coin_description: true
×
UNCOV
482
    config.add_show_field 'find_date_s', label: 'Find Date', link_to_facet: true, coin_description: true
×
UNCOV
483
    config.add_show_field 'find_locus_s', label: 'Find Locus', link_to_facet: true, coin_description: true
×
UNCOV
484
    config.add_show_field 'find_feature_s', label: 'Find Feature', link_to_facet: true, coin_description: true
×
UNCOV
485
    config.add_show_field 'find_description_s', label: 'Find Description', link_to_facet: true, coin_description: true
×
UNCOV
486
    config.add_show_field 'technique_s', label: 'Technique', link_to_facet: true, coin_description: true
×
UNCOV
487
    config.add_show_field 'issue_shape_s', label: 'Shape', link_to_facet: true, coin_description: true
×
UNCOV
488
    config.add_show_field 'issue_edge_s', label: 'Edge', link_to_facet: true, coin_description: true
×
UNCOV
489
    config.add_show_field 'issue_color_s', label: 'Color', link_to_facet: true, coin_description: true
×
UNCOV
490
    config.add_show_field 'counter_stamp_s', label: 'Counter Stamp', link_to_facet: true, coin_description: true
×
UNCOV
491
    config.add_show_field 'analysis_s', label: 'Analysis', link_to_facet: true, coin_description: true
×
UNCOV
492
    config.add_show_field 'coin_citations_s', label: 'Citations', link_to_facet: true, coin_description: true
×
UNCOV
493
    config.add_show_field 'coin_references_s', label: 'References', link_to_facet: true, coin_description: true
×
494

495
    ## Provenance
UNCOV
496
    config.add_show_field 'numismatic_provenance_s', label: 'Provenance'
×
497

498
    #     Search fields will inherit the :qt solr request handler from
499
    #     config[:default_solr_parameters], OR can specify a different one
500
    #     with a :qt key/value. Below examples inherit, except for subject
501
    #     that specifies the same :qt as default for our own internal
502
    #     testing purposes.
503
    #
504
    # The :key is what will be used to identify this BL search field internally,
505
    # as well as in URLs -- so changing it after deployment may break bookmarked
506
    # urls.  A display label will be automatically calculated from the :key,
507
    # or can be specified manually to be different.
508

509
    # This one uses all the defaults set by the solr request handler. Which
510
    # solr request handler? The one set in config[:default_solr_parameters][:qt],
511
    # since we aren't specifying it otherwise.
512

513
    # To add an advanced option only search field:
514
    #   config.add_search_field("advanced_field") do |field|
515
    #   field.include_in_simple_select = false
516
    #   field.solr_parameters = { :qf => "advanced_field_solrname" }
517
    # end
518
    # if the request handler ends up being different for advanced fields, they must be
519
    # specifically included, while at the same time be removed from simple search:
520
    #   :include_in_advanced_search => true
521
    #   field.include_in_simple_select = false
522

UNCOV
523
    config.add_search_field 'all_fields', label: 'Keyword', placeholder_text: I18n.t('blacklight.search.form.search.placeholder')
×
524

525
    # Now we see how to over-ride Solr request handler defaults, in this
526
    # case for a BL "search field", which is really a dismax aggregate
527
    # of Solr search fields.
528

UNCOV
529
    config.add_search_field('title') do |field|
×
530
      # solr_parameters hash are sent to Solr as ordinary url query params.
UNCOV
531
      field.solr_parameters = {
×
UNCOV
532
        'spellcheck.dictionary': 'title',
×
UNCOV
533
        qf: '${title_qf}',
×
UNCOV
534
        pf: '${title_pf}'
×
UNCOV
535
      }
×
UNCOV
536
      field.dropdown_label = 'Title (keyword)'
×
UNCOV
537
      field.solr_adv_parameters = {
×
UNCOV
538
        qf: '$title_qf',
×
UNCOV
539
        pf: '$title_pf'
×
UNCOV
540
      }
×
UNCOV
541
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
542
    end
×
543

UNCOV
544
    config.add_search_field('author') do |field|
×
UNCOV
545
      field.solr_parameters = {
×
UNCOV
546
        'spellcheck.dictionary' => 'author',
×
UNCOV
547
        qf: '${author_qf}',
×
UNCOV
548
        pf: '${author_pf}'
×
UNCOV
549
      }
×
UNCOV
550
      field.dropdown_label = 'Author (keyword)'
×
UNCOV
551
      field.label = 'Author/Creator'
×
UNCOV
552
      field.solr_adv_parameters = {
×
UNCOV
553
        qf: '$author_qf',
×
UNCOV
554
        pf: '$author_pf'
×
UNCOV
555
      }
×
UNCOV
556
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
557
    end
×
558

559
    # Specifying a :qt only to show it's possible, and so our internal automated
560
    # tests can test it. In this case it's the same as
561
    # config[:default_solr_parameters][:qt], so isn't actually neccesary.
UNCOV
562
    config.add_search_field('subject') do |field|
×
UNCOV
563
      field.solr_parameters = {
×
UNCOV
564
        'spellcheck.dictionary': 'subject',
×
UNCOV
565
        qf: '${subject_qf}',
×
UNCOV
566
        pf: '${subject_pf}'
×
UNCOV
567
      }
×
UNCOV
568
      field.dropdown_label = 'Subject (keyword)'
×
UNCOV
569
      field.qt = 'search'
×
UNCOV
570
      field.solr_adv_parameters = {
×
UNCOV
571
        qf: '$subject_qf',
×
UNCOV
572
        pf: '$subject_pf'
×
UNCOV
573
      }
×
UNCOV
574
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
575
    end
×
576

UNCOV
577
    config.add_search_field('left_anchor') do |field|
×
UNCOV
578
      field.label = 'Title starts with'
×
UNCOV
579
      field.solr_parameters = {
×
UNCOV
580
        qf: '${left_anchor_qf}',
×
UNCOV
581
        pf: '${left_anchor_pf}'
×
UNCOV
582
      }
×
UNCOV
583
      field.solr_adv_parameters = {
×
UNCOV
584
        qf: '$left_anchor_qf',
×
UNCOV
585
        pf: '$left_anchor_pf'
×
UNCOV
586
      }
×
UNCOV
587
      field.advanced_parse = false
×
UNCOV
588
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
589
    end
×
590

UNCOV
591
    config.add_search_field('publisher') do |field|
×
UNCOV
592
      field.include_in_simple_select = false
×
UNCOV
593
      field.label = 'Publisher'
×
UNCOV
594
      field.solr_parameters = {
×
UNCOV
595
        qf: '${publisher_qf}',
×
UNCOV
596
        pf: '${publisher_pf}'
×
UNCOV
597
      }
×
UNCOV
598
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
599
    end
×
600

UNCOV
601
    config.add_search_field('in_series') do |field|
×
UNCOV
602
      field.include_in_advanced_search = false
×
UNCOV
603
      field.include_in_simple_select = false
×
UNCOV
604
      field.label = 'Series starts with'
×
UNCOV
605
      field.solr_parameters = {
×
UNCOV
606
        qf: '${in_series_qf}',
×
UNCOV
607
        pf: '${in_series_qf}'
×
UNCOV
608
      }
×
UNCOV
609
      field.solr_adv_parameters = {
×
UNCOV
610
        qf: '$in_series_qf',
×
UNCOV
611
        pf: '$in_series_pf'
×
UNCOV
612
      }
×
UNCOV
613
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
614
    end
×
615

UNCOV
616
    config.add_search_field('notes') do |field|
×
UNCOV
617
      field.include_in_simple_select = false
×
UNCOV
618
      field.label = 'Notes'
×
UNCOV
619
      field.solr_parameters = {
×
UNCOV
620
        qf: '${notes_qf}',
×
UNCOV
621
        pf: '${notes_pf}'
×
UNCOV
622
      }
×
UNCOV
623
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
624
    end
×
625

UNCOV
626
    config.add_search_field('series_title') do |field|
×
UNCOV
627
      field.include_in_simple_select = false
×
UNCOV
628
      field.label = 'Series title'
×
UNCOV
629
      field.solr_parameters = {
×
UNCOV
630
        qf: '${series_title_qf}',
×
UNCOV
631
        pf: '${series_title_pf}'
×
UNCOV
632
      }
×
UNCOV
633
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
634
    end
×
635

UNCOV
636
    config.add_search_field('isbn') do |field|
×
UNCOV
637
      field.include_in_simple_select = false
×
UNCOV
638
      field.label = 'ISBN'
×
UNCOV
639
      field.solr_adv_parameters = {
×
UNCOV
640
        qf: 'isbn_t'
×
UNCOV
641
      }
×
UNCOV
642
      field.solr_parameters = {
×
UNCOV
643
        qf: 'isbn_t'
×
UNCOV
644
      }
×
UNCOV
645
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
646
    end
×
647

UNCOV
648
    config.add_search_field('issn') do |field|
×
UNCOV
649
      field.include_in_simple_select = false
×
UNCOV
650
      field.label = 'ISSN'
×
UNCOV
651
      field.solr_adv_parameters = {
×
UNCOV
652
        qf: 'issn_s'
×
UNCOV
653
      }
×
UNCOV
654
      field.solr_parameters = {
×
UNCOV
655
        qf: 'issn_s'
×
UNCOV
656
      }
×
UNCOV
657
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
658
    end
×
659

UNCOV
660
    config.add_search_field('lccn') do |field|
×
UNCOV
661
      field.include_in_simple_select = false
×
UNCOV
662
      field.include_in_advanced_search = false
×
UNCOV
663
      field.label = 'LCCN'
×
UNCOV
664
      field.solr_adv_parameters = {
×
UNCOV
665
        qf: 'lccn_s'
×
UNCOV
666
      }
×
UNCOV
667
      field.solr_parameters = {
×
UNCOV
668
        qf: 'lccn_s'
×
UNCOV
669
      }
×
UNCOV
670
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
671
    end
×
672

UNCOV
673
    config.add_search_field('oclc') do |field|
×
UNCOV
674
      field.include_in_simple_select = false
×
UNCOV
675
      field.include_in_advanced_search = false
×
UNCOV
676
      field.label = 'OCLC'
×
UNCOV
677
      field.solr_adv_parameters = {
×
UNCOV
678
        qf: 'oclc_s'
×
UNCOV
679
      }
×
UNCOV
680
      field.solr_adv_parameters = {
×
UNCOV
681
        qf: 'oclc_s'
×
UNCOV
682
      }
×
UNCOV
683
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
684
    end
×
685

UNCOV
686
    config.add_search_field('browse_subject') do |field|
×
UNCOV
687
      field.include_in_advanced_search = false
×
UNCOV
688
      field.label = 'Subject (browse)'
×
UNCOV
689
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
690
    end
×
UNCOV
691
    config.add_search_field('browse_name') do |field|
×
UNCOV
692
      field.include_in_advanced_search = false
×
UNCOV
693
      field.label = 'Author (browse)'
×
UNCOV
694
      field.placeholder_text = 'Last name, first name'
×
UNCOV
695
      field.placeholder_text = I18n.t('blacklight.search.form.search.placeholder')
×
UNCOV
696
    end
×
UNCOV
697
    config.add_search_field('name_title') do |field|
×
UNCOV
698
      field.include_in_advanced_search = false
×
UNCOV
699
      field.label = 'Author (sorted by title)'
×
UNCOV
700
      field.placeholder_text = 'Last name, first name. Title'
×
UNCOV
701
    end
×
UNCOV
702
    config.add_search_field('browse_cn') do |field|
×
UNCOV
703
      field.include_in_advanced_search = false
×
UNCOV
704
      field.label = 'Call number (browse)'
×
UNCOV
705
      field.placeholder_text = 'e.g. P19.737.3'
×
UNCOV
706
    end
×
707

708
    # "sort results by" select (pulldown)
709
    # label in pulldown is followed by the name of the SOLR field to sort by and
710
    # whether the sort is ascending or descending (it must be asc or desc
711
    # except in the relevancy case).
UNCOV
712
    config.add_sort_field 'score desc, pub_date_start_sort desc, title_sort asc', label: 'relevance'
×
UNCOV
713
    config.add_sort_field 'location asc, advanced_location_s asc, call_number_browse_s asc', label: 'library',
×
UNCOV
714
                                                                                             if: lambda { |controller, _config|
×
UNCOV
715
                                                                                               controller.controller_path == 'bookmarks'
×
UNCOV
716
                                                                                             }
×
UNCOV
717
    config.add_sort_field 'pub_date_start_sort desc, title_sort asc, score desc', label: 'year (newest first)'
×
UNCOV
718
    config.add_sort_field 'pub_date_start_sort asc, title_sort asc, score desc', label: 'year (oldest first)'
×
UNCOV
719
    config.add_sort_field 'author_sort asc, title_sort asc, score desc', label: 'author'
×
UNCOV
720
    config.add_sort_field 'title_sort asc, pub_date_start_sort desc, score desc', label: 'title'
×
UNCOV
721
    config.add_sort_field 'cataloged_tdt desc, title_sort asc, score desc', label: 'date cataloged'
×
722

UNCOV
723
    config.add_email_field 'title_display', label: 'Title'
×
UNCOV
724
    config.add_email_field 'title_vern_display', label: 'Title'
×
UNCOV
725
    config.add_email_field 'author_display', label: 'Author'
×
UNCOV
726
    config.add_email_field 'pub_created_display', label: 'Published/Created'
×
UNCOV
727
    config.add_email_field 'format', label: 'Format'
×
UNCOV
728
    config.add_email_field 'electronic_access_1display', label: 'Online access', presenter: Orangelight::ElectronicAccessPlainTextPresenter
×
UNCOV
729
    config.add_email_field 'electronic_portfolio_s', label: 'Online access', presenter: Orangelight::ElectronicPortfolioPlainTextPresenter
×
730

731
    # If there are more than this many search results, no spelling ("did you
732
    # mean") suggestion is offered.
UNCOV
733
    config.spell_max = 0
×
734

UNCOV
735
    config.add_results_document_tool(:bookmark, partial: 'bookmark_control')
×
736

UNCOV
737
    config.filter_search_state_fields = true
×
UNCOV
738
    config.search_state_fields = config.search_state_fields + [
×
UNCOV
739
      :advanced_type, :clause, :boolean_operator1, :boolean_operator2
×
UNCOV
740
    ]
×
741

UNCOV
742
    config.index.constraints_component = Orangelight::ConstraintsComponent
×
743

UNCOV
744
    config.crawler_detector = lambda { |request|
×
UNCOV
745
      return true if request.env['HTTP_USER_AGENT'].blank?
×
UNCOV
746
      request.bot?
×
UNCOV
747
    }
×
UNCOV
748
  end
×
749

UNCOV
750
  def sms_mappings
×
751
    # remove AT&T from Send me a Text option
752
    super.except('AT&T')
×
UNCOV
753
  end
×
754

UNCOV
755
  def render_search_results_as_json
×
756
    { response: { docs: @document_list, facets: search_facets_as_json, pages: pagination_info(@response) } }
×
UNCOV
757
  end
×
758

UNCOV
759
  def index
×
UNCOV
760
    solrize_boolean_params
×
UNCOV
761
    if no_search_yet?
×
UNCOV
762
      render_empty_search
×
UNCOV
763
    elsif bot_is_attempting_expensive_search?
×
UNCOV
764
      head :uri_too_long
×
UNCOV
765
    else
×
UNCOV
766
      super
×
UNCOV
767
    end
×
UNCOV
768
  rescue ActionController::BadRequest
×
769
    render file: Rails.public_path.join('x400.html'), layout: true, status: :bad_request
×
UNCOV
770
  end
×
771

UNCOV
772
  def numismatics
×
UNCOV
773
    @response = search_service.search_results
×
UNCOV
774
    respond_to do |format|
×
UNCOV
775
      format.html { render "advanced/numismatics" }
×
UNCOV
776
      format.json { render plain: "Format not supported", status: :bad_request }
×
UNCOV
777
    end
×
UNCOV
778
  end
×
779

UNCOV
780
  def librarian_view
×
UNCOV
781
    if agent_is_crawler?
×
UNCOV
782
      basic_response
×
UNCOV
783
    else
×
784
      # rubocop:disable Lint/SuppressedException
785
      # This exception is handled in the view layer
UNCOV
786
      begin
×
UNCOV
787
        super
×
UNCOV
788
      rescue Blacklight::Exceptions::RecordNotFound
×
UNCOV
789
      end
×
790
      # rubocop:enable Lint/SuppressedException
UNCOV
791
    end
×
UNCOV
792
  end
×
793

UNCOV
794
  def show
×
UNCOV
795
    if agent_is_crawler? && request.format.endnote?
×
UNCOV
796
      basic_response
×
UNCOV
797
    else
×
UNCOV
798
      super
×
UNCOV
799
    end
×
UNCOV
800
  end
×
801

UNCOV
802
  def citation
×
UNCOV
803
    if agent_is_crawler?
×
UNCOV
804
      basic_response
×
UNCOV
805
    else
×
UNCOV
806
      @documents = search_service.fetch(Array(params[:id]), { fl: "author_citation_display, title_citation_display, pub_citation_display, number_of_pages_citation_display, pub_date_start_sort, edition_display, format" })
×
UNCOV
807
      raise Blacklight::Exceptions::RecordNotFound if @documents.blank?
×
UNCOV
808
    end
×
UNCOV
809
  end
×
810

UNCOV
811
  def report_biased_results_form; end
×
812

UNCOV
813
  def biased_results_submit; end
×
814

UNCOV
815
  def advanced_search
×
UNCOV
816
    if no_search_yet?
×
UNCOV
817
      @response = empty_solr_response(empty_advanced_search_raw_response)
×
UNCOV
818
    else
×
UNCOV
819
      super
×
UNCOV
820
    end
×
UNCOV
821
  end
×
822

UNCOV
823
  private
×
824

UNCOV
825
    def json_request?
×
UNCOV
826
      request.format.json?
×
UNCOV
827
    end
×
828

UNCOV
829
    def render_empty_search
×
830
      # This code is a copy of Blacklight::Catalog.index() method but adapted to use
831
      # a cached version of the data rather than requesting the data from Solr.
832
      # See https://github.com/projectblacklight/blacklight/blob/v7.0.1/app/controllers/concerns/blacklight/catalog.rb#L25-L41
UNCOV
833
      @response = empty_solr_response
×
UNCOV
834
      @document_list = @response.documents
×
UNCOV
835
      respond_to do |format|
×
UNCOV
836
        format.html { store_preferred_view }
×
UNCOV
837
        format.rss  { render layout: false }
×
UNCOV
838
        format.atom { render layout: false }
×
UNCOV
839
        format.json do
×
840
          @presenter = Blacklight::JsonPresenter.new(@response, blacklight_config)
×
UNCOV
841
        end
×
UNCOV
842
        additional_response_formats(format)
×
UNCOV
843
        document_export_formats(format)
×
UNCOV
844
      end
×
UNCOV
845
    end
×
846

UNCOV
847
    def no_search_yet?
×
848
      # When only the "controller" and "action" keys are in the request (i.e. no query or facets)
849
      # we consider it the home page.
UNCOV
850
      params.keys.count == 2
×
UNCOV
851
    end
×
852

UNCOV
853
    def empty_solr_response(cached_response = empty_raw_response)
×
UNCOV
854
      raw_response = JSON.parse(cached_response)
×
UNCOV
855
      Blacklight::Solr::Response.new(raw_response, raw_response["responseHeader"]["params"], blacklight_config: @blacklight_config)
×
UNCOV
856
    end
×
857

UNCOV
858
    def empty_raw_response
×
UNCOV
859
      Rails.cache.fetch("home_page_empty_raw_response", expires_in: 3.hours) do
×
UNCOV
860
        Rails.logger.info "Cached home page results"
×
861
        # We cannot cache the Blacklight::Solr::Response as-is so we convert it to JSON first
UNCOV
862
        search_service.search_results.to_json
×
UNCOV
863
      end
×
UNCOV
864
    end
×
865

UNCOV
866
    def empty_advanced_search_raw_response
×
UNCOV
867
      Rails.cache.fetch('advanced_search_form_empty_raw_response', expires_in: 8.hours) do
×
UNCOV
868
        Rails.logger.info "Cached empty advanced search form solr query"
×
UNCOV
869
        blacklight_advanced_search_form_search_service.search_results.to_json
×
UNCOV
870
      end
×
UNCOV
871
    end
×
872

UNCOV
873
    def basic_response
×
UNCOV
874
      render plain: 'OK'
×
UNCOV
875
      nil
×
UNCOV
876
    end
×
877

UNCOV
878
    def bot_is_attempting_expensive_search?
×
UNCOV
879
      request.bot? && many_facets?
×
UNCOV
880
    end
×
881

882
    # :reek:TooManyStatements
UNCOV
883
    def many_facets?
×
UNCOV
884
      value_count_in_params = ->(facet) { facet.is_a?(Array) ? facet.length : 1 }
×
885

UNCOV
886
      facet_count_in_param = lambda do |param|
×
UNCOV
887
        if param.is_a? ActionController::Parameters
×
UNCOV
888
          param&.values&.sum(&value_count_in_params) || 0
×
UNCOV
889
        else
×
UNCOV
890
          0
×
UNCOV
891
        end
×
UNCOV
892
      end
×
893

UNCOV
894
      params.values_at(:f_inclusive, :f).sum(&facet_count_in_param) >= 5
×
UNCOV
895
    end
×
896

UNCOV
897
    def search_service_context
×
UNCOV
898
      if action_name == 'advanced_search'
×
UNCOV
899
        { search_builder_class: AdvancedFormSearchBuilder }
×
UNCOV
900
      elsif action_name == 'numismatics'
×
UNCOV
901
        { search_builder_class: NumismaticsFormSearchBuilder }
×
UNCOV
902
      else
×
UNCOV
903
        {}
×
UNCOV
904
      end
×
UNCOV
905
    end
×
906

UNCOV
907
    def solrize_boolean_params
×
UNCOV
908
      @search_state = search_state.reset(AdvancedBooleanOperators.new(search_state.params).for_boolqparser)
×
UNCOV
909
    end
×
UNCOV
910
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc