Sha256: a3f2576d5f4094106d5671dab48d0253f3941874a4c17c2efc521ba1e6cc6b75
Contents?: true
Size: 1.11 KB
Versions: 49
Compression:
Stored size: 1.11 KB
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 def find_each return to_enum(:find_each) unless block_given? start = 0 search_params = { q: '*:*', fl: 'id', facet: false } response = index.search(search_params.merge(start: start)) while response.documents.present? response.documents.each { |x| yield x } start += response.documents.length response = index.search(search_params.merge(start: start)) end 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
49 entries across 49 versions & 1 rubygems