Sha256: eca121238414e85aa880fcaebe80e9b284ee49a8991f60c1a32fe16b783d5fc4

Contents?: true

Size: 989 Bytes

Versions: 20

Compression:

Stored size: 989 Bytes

Contents

# frozen_string_literal: true
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

20 entries across 20 versions & 1 rubygems

Version Path
geoblacklight-3.8.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.8.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-4.0.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-4.0.0.pre.rc3 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.7.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-4.0.0.pre.rc2 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-4.0.0.pre.rc1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.6.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.5.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-4.0.0.pre.alpha.3 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-4.0.0.pre.alpha.2 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-4.0.0.pre.alpha.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-4.0.0.pre.alpha app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.4.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.3.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.3.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.2.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.1.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.0.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-3.0.0 app/models/concerns/geoblacklight/solr_document/finder.rb