@@ -55,38 +55,79 @@ def routing_params(args = {})
55
55
end
56
56
end
57
57
58
- def self . configure_local_blacklight ( config , default_fq :, routing_params :, search_configuration :, search_type :)
59
- config . default_solr_params [ :fq ] += default_fq
60
- config . show . route = routing_params
61
- config . track_search_session = search_type != SEARCH_CATALOG
62
- if search_type == SEARCH_LOCAL
63
- config . document_unique_id_param = :ezid_doi_ssim
64
- config . document_pagination_params [ :fl ] = "id,#{ config . document_unique_id_param } ,format"
65
- config . search_state_class = Dcv ::Sites ::LocalSearchState
58
+ def self . configure_blacklight_search_local ( config , search_configuration :, **_args )
59
+ config . document_unique_id_param = :ezid_doi_ssim
60
+ config . document_pagination_params [ :fl ] = "id,#{ config . document_unique_id_param } ,format"
61
+ config . search_state_class = Dcv ::Sites ::LocalSearchState
62
+ Dcv ::Configurators ::DcvBlacklightConfigurator . default_faceting_configuration ( config , geo : search_configuration . map_configuration . enabled )
63
+ if search_configuration . facets . present?
64
+ search_configuration . facets . each do |facet |
65
+ facet . configure ( config )
66
+ end
66
67
else
67
- config . show . route = routing_params
68
+ Dcv :: Configurators :: DcvBlacklightConfigurator . configure_facet_fields ( config )
68
69
end
69
- if search_type == SEARCH_LOCAL && search_configuration . facets . present?
70
+ if search_configuration . search_fields . present?
71
+ search_configuration . search_fields . each do |search_field |
72
+ search_field . configure ( config )
73
+ end
74
+ else
75
+ Dcv ::Configurators ::DcvBlacklightConfigurator . configure_keyword_search_field ( config )
76
+ end
77
+ Dcv ::Configurators ::DcvBlacklightConfigurator . default_component_configuration ( config )
78
+ config
79
+ end
80
+
81
+ def self . configure_blacklight_search_repositories ( config , search_configuration :, **_args )
82
+ config . document_unique_id_param = :ezid_doi_ssim
83
+ config . document_pagination_params [ :fl ] = "id,#{ config . document_unique_id_param } ,format"
84
+ config . search_state_class = Dcv ::SearchState
85
+ Dcv ::Configurators ::DcvBlacklightConfigurator . default_faceting_configuration ( config , geo : search_configuration . map_configuration . enabled )
86
+ if search_configuration . facets . present?
70
87
search_configuration . facets . each do |facet |
71
88
facet . configure ( config )
72
89
end
73
90
else
74
91
Dcv ::Configurators ::DcvBlacklightConfigurator . configure_facet_fields ( config )
75
92
end
76
- Dcv ::Configurators ::DcvBlacklightConfigurator . default_faceting_configuration ( config , geo : search_configuration . map_configuration . enabled )
77
- if search_type == SEARCH_LOCAL && search_configuration . search_fields . present?
93
+ config . add_facet_field ( 'content_availability' ,
94
+ label : 'Limit by Availability' ,
95
+ query : {
96
+ onsite : { label : 'Reading Room' , fq : "{!join from=cul_member_of_ssim to=fedora_pid_uri_ssi}!access_control_levels_ssim:Public*" } ,
97
+ public : { label : 'Public' , fq : "{!join from=cul_member_of_ssim to=fedora_pid_uri_ssi}access_control_levels_ssim:Public*" } ,
98
+ }
99
+ )
100
+ if search_configuration . search_fields . present?
78
101
search_configuration . search_fields . each do |search_field |
79
102
search_field . configure ( config )
80
103
end
81
104
else
82
105
Dcv ::Configurators ::DcvBlacklightConfigurator . configure_keyword_search_field ( config )
83
106
end
84
- Dcv ::Configurators ::DcvBlacklightConfigurator . default_component_configuration ( config )
85
- end
107
+ config . search_state_fields << :repository_id # allow repository id for routing
108
+ Dcv ::Configurators ::DcvBlacklightConfigurator . default_component_configuration ( config , search_bar : Dcv ::SearchBar ::RepositoriesComponent )
109
+ config
110
+ end
111
+
112
+ def self . configure_site_blacklight ( config , default_fq :, routing_params :, search_configuration :, search_type :)
113
+ config . default_solr_params [ :fq ] += default_fq
114
+ config . show . route = routing_params
115
+ config . track_search_session = search_type != SEARCH_CATALOG
116
+ if search_type == SEARCH_LOCAL
117
+ configure_blacklight_search_local ( config , search_configuration : search_configuration )
118
+ elsif search_type == SEARCH_REPOSITORIES
119
+ configure_blacklight_search_repositories ( config , search_configuration : search_configuration )
120
+ else
121
+ Dcv ::Configurators ::DcvBlacklightConfigurator . configure_facet_fields ( config )
122
+ Dcv ::Configurators ::DcvBlacklightConfigurator . configure_keyword_search_field ( config )
123
+ Dcv ::Configurators ::DcvBlacklightConfigurator . default_component_configuration ( config )
124
+ config
125
+ end
126
+ end
86
127
87
128
def configure_blacklight!
88
129
configure_blacklight do |config |
89
- Site . configure_local_blacklight ( config , default_fq : default_fq , routing_params : routing_params , search_configuration : search_configuration , search_type : search_type )
130
+ Site . configure_site_blacklight ( config , default_fq : default_fq , routing_params : routing_params , search_configuration : search_configuration , search_type : search_type )
90
131
end
91
132
end
92
133
0 commit comments