Sha256: 365bae2442a6a6abdc2324a20e2bb5514b3548b4bde2a58403aa58251958346b

Contents?: true

Size: 959 Bytes

Versions: 30

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

30 entries across 30 versions & 1 rubygems

Version Path
geoblacklight-2.4.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-2.3.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-2.2.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-2.2.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-2.1.2 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-2.1.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-2.1.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-2.0.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.9.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.9.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.8.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.7.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.7.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.6.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.5.1 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.5.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.4.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.3.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.2.0 app/models/concerns/geoblacklight/solr_document/finder.rb
geoblacklight-1.1.2 app/models/concerns/geoblacklight/solr_document/finder.rb