Module: ActiveFedora::Indexing::ClassMethods
- Defined in:
- lib/active_fedora/indexing.rb
Instance Method Summary collapse
-
#descendant_uris(uri, exclude_uri: false) ⇒ Object
rubocop:enable Naming/VariableName.
-
#index_config ⇒ Object
ActiveFedora::Indexing::Map.
-
#reindex_everything(batch_size: 50, softCommit: true, progress_bar: false, final_commit: false) ⇒ Object
rubocop:disable Naming/VariableName.
Instance Method Details
#descendant_uris(uri, exclude_uri: false) ⇒ Object
rubocop:enable Naming/VariableName
134 135 136 |
# File 'lib/active_fedora/indexing.rb', line 134 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.
88 89 90 91 92 93 94 |
# File 'lib/active_fedora/indexing.rb', line 88 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
rubocop:disable Naming/VariableName
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 126 127 128 129 130 131 |
# File 'lib/active_fedora/indexing.rb', line 101 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 end if batch.present? SolrService.add(batch, softCommit: softCommit) batch.clear end return unless final_commit logger.debug "Solr hard commit..." SolrService.commit end |