Sha256: 4b73abbe667b511bbb3d0839b9c7264fbc0960e9e45281f289d7090af1f2f8f5

Contents?: true

Size: 959 Bytes

Versions: 5

Compression:

Stored size: 959 Bytes

Contents

module Geoblacklight
  module SolrDocument
    ##
    # Finder methods for SolrDocuments
    # modeled after Spotlight's Finder module
    # https://github.com/sul-dlss/spotlight/blob/master/app/models/concerns/spotlight/solr_document/finder.rb
    module Finder
      extend ActiveSupport::Concern
      include Blacklight::Configurable

      ##
      # Class level finder methods for documents
      module ClassMethods

        ##
        # Find a Solr Document from an index
        # @param [String]
        def find(id)
          solr_response = index.find(id)
          solr_response.documents.first
        end

        def index
          @index ||= blacklight_config.repository_class.new(blacklight_config)
        end

        protected

        def blacklight_config
          @conf ||= copy_blacklight_config_from(CatalogController)
        end
      end

      def blacklight_solr
        self.class.index.connection
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geoblacklight-0.11.1 lib/geoblacklight/solr_document/finder.rb
geoblacklight-0.11.0 lib/geoblacklight/solr_document/finder.rb
geoblacklight-0.10.2 lib/geoblacklight/solr_document/finder.rb
geoblacklight-0.10.1 lib/geoblacklight/solr_document/finder.rb
geoblacklight-0.10.0 lib/geoblacklight/solr_document/finder.rb