projectblacklight / blacklight

Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr) index.
http://projectblacklight.org/
Other
757 stars 256 forks source link

undefined `search_service' after upgrade Blacklight 7 to 8 #3108

Closed ta1986 closed 8 months ago

ta1986 commented 8 months ago

I created ImagesController as following to provide iiif manifest service:

require 'net/http'
require 'json'

class ImagesController < ApplicationController
  extend ActiveSupport::Concern
  include Blacklight::Searchable 
  include Blacklight::Catalog

  def manifest
    @response, @document = search_service.fetch(params[:id])

    ...

  end
end

This works fine in Blacklight 7 but I got undefined local variable or method `search_service' after upgrade to Blacklight 8. Is the commit e80c1b8 related? Could you please suggest a work around?

ta1986 commented 8 months ago

I'm able to resolve the issue in Blacklight 8 by: Reorder "extend ActiveSupport::Concern" and "include Blacklight::Searchable" Remove @response per number 2 in https://github.com/projectblacklight/blacklight/wiki/Upgrading-to-Blacklight-8#upgrade-notes

require 'net/http'
require 'json'

class ImagesController < ApplicationController
  include Blacklight::Searchable
  extend ActiveSupport::Concern
  include Blacklight::Catalog

  def manifest
    @document = search_service.fetch(params[:id])
    ...
  end
end