Module: ActiveFedora::Indexing::ClassMethods
- Defined in:
- lib/active_fedora/indexing.rb
Instance Method Summary collapse
- #descendant_uris(uri, exclude_uri: false) ⇒ Object
-
#index_config ⇒ Object
ActiveFedora::Indexing::Map.
- #reindex_everything(batch_size: 50, softCommit: true, progress_bar: false, final_commit: false) ⇒ Object
Instance Method Details
#descendant_uris(uri, exclude_uri: false) ⇒ Object
127 128 129 |
# File 'lib/active_fedora/indexing.rb', line 127 def descendant_uris(uri, exclude_uri: false) DescendantFetcher.new(uri, exclude_self: exclude_uri).descendant_and_self_uris end |
#index_config ⇒ Object
Returns ActiveFedora::Indexing::Map.
83 84 85 86 87 88 89 |
# File 'lib/active_fedora/indexing.rb', line 83 def index_config @index_config ||= if superclass.respond_to?(:index_config) superclass.index_config.deep_dup else ActiveFedora::Indexing::Map.new end end |
#reindex_everything(batch_size: 50, softCommit: true, progress_bar: false, final_commit: false) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/active_fedora/indexing.rb', line 95 def reindex_everything(batch_size: 50, softCommit: true, progress_bar: false, final_commit: false) # skip root url descendants = descendant_uris(ActiveFedora.fedora.base_uri, exclude_uri: true) batch = [] = ProgressBar.create(total: descendants.count, format: "%t: |%B| %p%% %e") if descendants.each do |uri| logger.debug "Re-index everything ... #{uri}" batch << ActiveFedora::Base.find(ActiveFedora::Base.uri_to_id(uri)).to_solr if (batch.count % batch_size).zero? SolrService.add(batch, softCommit: softCommit) batch.clear end .increment if end if batch.present? SolrService.add(batch, softCommit: softCommit) batch.clear end if final_commit logger.debug "Solr hard commit..." SolrService.commit end end |