app/models/concerns/spotlight/solr_document/atomic_updates.rb in blacklight-spotlight-0.1.0 vs app/models/concerns/spotlight/solr_document/atomic_updates.rb in blacklight-spotlight-0.2.0

- old
+ new

@@ -11,16 +11,24 @@ data = to_solr data = [data] unless data.is_a? Array data.map do |doc| Hash[doc.map do |k,v| - val = if k == :id or k == "id" + val = if k.to_sym == unique_key_field.to_sym v else { set: v } end [k,val] - end] + end] end.reject { |x| x.length <= 1 } + end + + def unique_key_field + if respond_to?(:blacklight_config) + blacklight_config.solr_document_model.unique_key + else + 'id' + end end end