vecnet / dl-discovery

Map based discovery interface for digital library records
Other
4 stars 3 forks source link

Blacklight pagination for prev next document doesn't work as lacks a search_session? #94

Open stevenvandervalk opened 9 years ago

stevenvandervalk commented 9 years ago

https://github.com/vecnet/dl-discovery/blob/qa-deploy/app/views/catalog/show.html.erb

Should render a partial previous_and_next_doc for pagination to previous next and back to search. It seems to not work currently as

<% if @previous_document || @next_document %>

don't exist until the Blacklight lib search_context.rb makes them as it contains the function setup_next_and_previous_documents

 # calls setup_previous_document then setup_next_document.
  # used in the show action for single view pagination.
  def setup_next_and_previous_documents
    if search_session['counter'] and current_search_session
      index = search_session['counter'].to_i - 1
      response, documents = get_previous_and_next_documents_for_search index, current_search_session.query_params.with_indifferent_access

      search_session['total'] = response.total
      @search_context_response = response
      @previous_document = documents.first
      @next_document = documents.last
    end
  rescue Blacklight::Exceptions::InvalidRequest => e
    logger.warn "Unable to setup next and previous documents: #{e}"
  end

That code should already be running as part of the show method in catalog.rb

 # get a single document from the index
    # to add responses for formats other than html or json see _Blacklight::Document::Export_
    def show
      @response, @document = fetch params[:id]

      respond_to do |format|
        format.html { setup_next_and_previous_documents }

Just in case I included it in the controller manually but no dice, still no @previous_document etc.

@dbrower Any ideas?

dbrower commented 9 years ago

I have no idea. I can look at it, but I'd like to first look at the h_facet indexing.

stevenvandervalk commented 9 years ago

Yep. Thanks for replying I just thought I would ask.

Sent from my phone 0468311883

On 25 Jun 2015, at 22:15, Don Brower notifications@github.com<mailto:notifications@github.com> wrote:

I have no idea. I can look at it, but I'd like to first look at the h_facet indexing.

Reply to this email directly or view it on GitHubhttps://github.com/vecnet/dl-discovery/issues/94#issuecomment-115229171.