Sha256: 4dd7d33de1de8aa27f0a08ae5a0b2401c34ef5ec828d0eb396647e200696d4b2
Contents?: true
Size: 844 Bytes
Versions: 22
Compression:
Stored size: 844 Bytes
Contents
module Spotlight module SolrDocument ## # Solr indexing strategy using Solr's Atomic Updates module AtomicUpdates def reindex data = hash_for_solr_update(to_solr) blacklight_solr.update params: { commitWithin: 500 }, data: data.to_json, headers: { 'Content-Type' => 'application/json' } unless data.empty? end private def hash_for_solr_update(data) Array.wrap(data).map { |doc| convert_document_to_atomic_update_hash(doc) }.reject { |x| x.length <= 1 } end def convert_document_to_atomic_update_hash(doc) doc.each_with_object({}) do |(k, v), hash| hash[k] = if k.to_sym == self.class.unique_key.to_sym v else { set: v } end end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems