lib/cul_hydra/indexer.rb in cul_hydra-1.4.10 vs lib/cul_hydra/indexer.rb in cul_hydra-1.4.11

- old
+ new

@@ -64,22 +64,27 @@ self.index_pid(pid, skip_generic_resources, verbose_output) end end - def self.index_pid(pid, skip_generic_resources=false, verbose_output=false) + def self.index_pid(pid, skip_generic_resources=false, verbose_output=false, softcommit=true) # We found an object with the desired PID. Let's reindex it begin active_fedora_object = nil NUM_FEDORA_RETRY_ATTEMPTS.times do |i| begin active_fedora_object = ActiveFedora::Base.find(pid, :cast => true) if skip_generic_resources && active_fedora_object.is_a?(GenericResource) puts 'Object was skipped because GenericResources are being skipped and it is a GenericResource.' else - active_fedora_object.update_index + if softcommit + active_fedora_object.update_index + else + # Using direct solr query to update document without soft commiting + ActiveFedora::SolrService.add(active_fedora_object.to_solr) + end puts 'done.' if verbose_output end break rescue RestClient::RequestTimeout, Errno::EHOSTUNREACH => e remaining_attempts = (NUM_FEDORA_RETRY_ATTEMPTS-1) - i @@ -106,6 +111,6 @@ raise e rescue Exception => e puts "Encountered problem with #{pid}. Skipping record. Exception class: #{e.class.name}. Message: #{e.message}" end end -end \ No newline at end of file +end