@@ -67,19 +67,7 @@ def find *args
6767
6868 # returns a params hash for finding a single solr document (CatalogController #show action)
6969 def solr_doc_params ( id = nil )
70- id ||= params [ :id ]
71-
72- # add our document id to the document_unique_id_param query parameter
73- p = blacklight_config . default_document_solr_params . merge ( {
74- # this assumes the request handler will map the unique id param
75- # to the unique key field using either solr local params, the
76- # real-time get handler, etc.
77- blacklight_config . document_unique_id_param => id
78- } )
79-
80- p [ :qt ] ||= blacklight_config . document_solr_request_handler
81-
82- p
70+ default_solr_doc_params ( id )
8371 end
8472 deprecation_deprecate :solr_doc_params
8573
@@ -116,6 +104,20 @@ def query_solr(user_params = params || {}, extra_controller_params = {})
116104 # retrieve a solr document, given the doc id
117105 # @return [Blacklight::SolrResponse, Blacklight::SolrDocument] the solr response object and the first document
118106 def get_solr_response_for_doc_id ( id = nil , extra_controller_params = { } )
107+ if id . nil?
108+ Deprecation . warn Blacklight ::SolrHelper , "Calling #get_solr_response_for_doc_id without an explicit id argument is deprecated"
109+ id ||= params [ :id ]
110+ end
111+
112+ old_solr_doc_params = Deprecation . silence ( Blacklight ::SolrHelper ) do
113+ solr_doc_params ( id )
114+ end
115+
116+ if default_solr_doc_params ( id ) != old_solr_doc_params
117+ Deprecation . warn Blacklight ::SolrHelper , "The #solr_doc_params method is deprecated. Instead, you should provide a custom SolrRepository implementation for the additional behavior you're offering"
118+ extra_controller_params = extra_controller_params . merge ( old_solr_doc_params )
119+ end
120+
119121 solr_response = solr_repository . find id , extra_controller_params
120122 [ solr_response , solr_response . documents . first ]
121123 end
@@ -234,4 +236,24 @@ def solr_repository
234236 @solr_repository ||= Blacklight ::SolrRepository . new ( blacklight_config )
235237 end
236238
239+ private
240+
241+ ##
242+ # @deprecated
243+ def default_solr_doc_params ( id = nil )
244+ id ||= params [ :id ]
245+
246+ # add our document id to the document_unique_id_param query parameter
247+ p = blacklight_config . default_document_solr_params . merge ( {
248+ # this assumes the request handler will map the unique id param
249+ # to the unique key field using either solr local params, the
250+ # real-time get handler, etc.
251+ blacklight_config . document_unique_id_param => id
252+ } )
253+
254+ p [ :qt ] ||= blacklight_config . document_solr_request_handler
255+
256+ p
257+ end
258+
237259end
0 commit comments