Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stevenvandervalk opened this issue Jun 25, 2015 · 2 comments
Assignees

Comments

@stevenvandervalk
Copy link
Member

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
Copy link
Member

dbrower commented Jun 25, 2015

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

@stevenvandervalk
Copy link
Member Author

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

Sent from my phone
0468311883

On 25 Jun 2015, at 22:15, Don Brower <[email protected]mailto:[email protected]> 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//issues/94#issuecomment-115229171.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants