app/services/blacklight/search_service.rb
# Get the previous and next document from a search result
# @return [Blacklight::Solr::Response, Array<Blacklight::SolrDocument>] the solr response and a list of the first and last document
Get the previous and next document from a search result
Get the previous and next document from a search result
def previous_and_next_documents_for_search(index, request_params, extra_controller_params = {})
      if !request_params[:q_row].nil? and !request_params[:q].nil?
        request_params.delete(:q)
      end
      p = previous_and_next_document_params(index)
      query = search_builder.with(request_params).start(p.delete(:start)).rows(p.delete(:rows)).merge(extra_controller_params).merge(p)
      response = repository.search(query)
      document_list = response.documents
      prev_doc = document_list.first if index > 0
      next_doc = document_list.last if (index + 1) < response.total
      [response, [prev_doc, next_doc]]
    end
def previous_and_next_documents_for_search ( index , request_params , extra_controller_params = { } ) if ! request_params [ :q_row ] . nil? and ! request_params [ :q ] . nil? request_params . delete ( :q ) end p = previous_and_next_document_params ( index ) query = search_builder . with ( request_params ) . start ( p . delete ( :start ) ) . rows ( p . delete ( :rows ) ) . merge ( extra_controller_params ) . merge ( p ) response = repository . search ( query ) document_list = response . documents prev_doc = document_list . first if index > 0 next_doc = document_list . last if ( index + 1 ) < response . total [ response , [ prev_doc , next_doc ] ] end
Get the previous and next document from a search result
Get the previous and next document from a search result
# only get the previous doc if there is one
the solr response and a list of the first and last document
the solr response and a list of the first and last document
Blacklight::Solr::Response, Array<Blacklight::SolrDocument>
index
<not_specific>
request_params
<not_specific>
extra_controller_params
<not_specific>