Sha256: 91c81232d85b941f04e6277a504c496545c144e77879c9d3ccf64f995d653e50
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true module Europeana module Blacklight ## # Local overrides for {Blacklight::SearchHelper} module SearchHelper extend ActiveSupport::Concern include ::Blacklight::SearchHelper # index arg counts from 0; API start param counts from 1 def previous_and_next_document_params(index, window = 1) start = index + 1 api_params = {} if start > 1 api_params[:start] = start - window # get one before api_params[:rows] = 2 * window + 1 # and one after else api_params[:start] = start # there is no previous doc api_params[:rows] = 2 * window # but there should be one after end api_params end private def fetch_many(ids = [], *args) if args.length == 1 user_params = params extra_controller_params = args.first || {} else user_params, extra_controller_params = args user_params ||= params extra_controller_params ||= {} end id_query = ids.map { |id| "europeana_id:\"/#{id}\"" }.join(' OR ') query = search_builder.with(user_params).where(id_query) api_response = repository.search(query.merge(extra_controller_params)) [api_response, api_response.documents] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
europeana-blacklight-1.3.1 | app/controllers/concerns/europeana/blacklight/search_helper.rb |
europeana-blacklight-1.3.0 | app/controllers/concerns/europeana/blacklight/search_helper.rb |