Sha256: 1cb61b8178adbe7bf3bcea86069ef22e82f970d238f69e887117a64b4436336d

Contents?: true

Size: 667 Bytes

Versions: 8

Compression:

Stored size: 667 Bytes

Contents

module Spotlight
  module SolrDocument
    ##
    # Finder methods for SolrDocuments
    module Finder
      extend ActiveSupport::Concern

      ##
      # Class level finder methods for documents
      module ClassMethods
        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 ||= Spotlight::Engine.blacklight_config
        end
      end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
blacklight-spotlight-0.8.2 app/models/concerns/spotlight/solr_document/finder.rb
blacklight-spotlight-0.8.1 app/models/concerns/spotlight/solr_document/finder.rb
blacklight-spotlight-0.8.0 app/models/concerns/spotlight/solr_document/finder.rb
blacklight-spotlight-0.7.2 app/models/concerns/spotlight/solr_document/finder.rb
blacklight-spotlight-0.7.1 app/models/concerns/spotlight/solr_document/finder.rb
blacklight-spotlight-0.7.0 app/models/concerns/spotlight/solr_document/finder.rb
blacklight-spotlight-0.6.0 app/models/concerns/spotlight/solr_document/finder.rb
blacklight-spotlight-0.5.0 app/models/concerns/spotlight/solr_document/finder.rb