Skip to content

Commit

Permalink
reindex_everything gets a final_commit option
Browse files Browse the repository at this point in the history
  • Loading branch information
jrochkind committed Mar 23, 2017
1 parent d173b3e commit 10b59e0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/active_fedora/indexing.rb
Expand Up @@ -83,7 +83,11 @@ def index_config
end
end

def reindex_everything(batch_size: 50, softCommit: true, progress_bar: false)
# @param [Integer] batch_size - The number of Fedora objects to process for each SolrService.add call. Default 50.
# @param [Boolean] softCommit - Do we perform a softCommit when we add the to_solr objects to SolrService. Default true.
# @param [Boolean] progress_bar - If true output progress bar information. Default false.
# @param [Boolean] final_commit - If true perform a hard commit to the Solr service at the completion of the batch of updates. Default false.
def reindex_everything(batch_size: 50, softCommit: true, progress_bar: false, final_commit: false)
descendants = descendant_uris(ActiveFedora.fedora.base_uri)
descendants.shift # Discard the root uri

Expand All @@ -108,6 +112,11 @@ def reindex_everything(batch_size: 50, softCommit: true, progress_bar: false)
SolrService.add(batch, softCommit: softCommit)
batch.clear
end

if final_commit
logger.debug "Solr hard commit..."
SolrService.commit
end
end

def descendant_uris(uri)
Expand Down

0 comments on commit 10b59e0

Please sign in to comment.