spotlight-dor-resources 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 020d6aad248dc730e3ee61896bb5883eb3842350
4
- data.tar.gz: 76cd9bc6a57381ce04336628dabe02ea8a00d94b
3
+ metadata.gz: b9c7b421a13eda5a5700db8c0bf1901f5f5838a3
4
+ data.tar.gz: 05e7e9e1f72e767085fb48df489843281bebfa1d
5
5
  SHA512:
6
- metadata.gz: fe9fd0ec3cf1e57b32183e71344d7e483ddb94562e09464d586d2377dfab0070fa8ff3b82b24ffcefd7bd7b16fb062c66721dbdad2c9456e4b394b03c77ac639
7
- data.tar.gz: 42fef0ae0264474124e6dffd8eada91b6d463760b40e5a28e1388227a594d2844afb32663de4f1b6d0d6d149b9fc5a379e2413bd3c65da329bdc985cf79d80e5
6
+ metadata.gz: 84d0129c9e2a56a2f2962d659a63a6f1a861b771e32a4901704f1be5307dd57fffa57dab5595e71563fde33454b87d708af789e29f1ce90b91f251b28d2d8fe4
7
+ data.tar.gz: 445c27164425683a629d5fb7eea1aeb0327462bab585cdec08506060782486119d66e2e5ac02353c092d963653ed996f0b942cb7e66ea57b4380f16f7546c742
@@ -4,33 +4,22 @@ module Spotlight::Resources
4
4
  include ActiveSupport::Benchmarkable
5
5
 
6
6
  ##
7
- # Generate solr documents for the DOR resources identified by this object.
7
+ # Generate solr documents for the DOR resources identified by this object
8
8
  #
9
9
  # @return [Enumerator] an enumerator of solr document hashes for indexing
10
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
11
- def to_solr(&block)
10
+ def to_solr
12
11
  return to_enum(:to_solr) { indexable_resources.size } unless block_given?
13
12
 
14
- # We use the Parallel gem to support parallel processing of the collection,
15
- # but need to jump through some hoops to make it yield an enumerable in the end.
16
- #
17
- # Here, we create a hook that simply yields the result to the enumerable. We configure
18
- # this as a 'finish' hook, which Parallel will run on the main process.
19
- yield_to_enum = ->(_item, _i, result) { block.call(result) }
20
-
21
- size = indexable_resources.size
22
-
23
- benchmark "Indexing resource #{inspect} (est. #{size} items)" do
13
+ benchmark "Indexing resource #{inspect}" do
24
14
  base_doc = super
25
15
 
26
- Parallel.each_with_index(indexable_resources, parallel_options.merge(finish: yield_to_enum)) do |res, idx|
27
- benchmark "Indexing item #{res.druid} in resource #{id} (#{idx} / #{size})" do
28
- base_doc.merge(to_solr_document(res))
16
+ indexable_resources.each_with_index do |res, idx|
17
+ benchmark "Indexing item #{res.druid} in resource #{id} (#{idx})" do
18
+ yield base_doc.merge(to_solr_document(res))
29
19
  end
30
20
  end
31
21
  end
32
22
  end
33
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
34
23
 
35
24
  def resource
36
25
  @resource ||= Spotlight::Dor::Resources.indexer.resource doc_id
@@ -67,9 +56,5 @@ module Spotlight::Resources
67
56
  def logger
68
57
  Spotlight::Dor::Resources.indexer.logger
69
58
  end
70
-
71
- def parallel_options
72
- Spotlight::Dor::Resources::Engine.config.parallel_options
73
- end
74
59
  end
75
60
  end
@@ -2,7 +2,7 @@ module Spotlight
2
2
  module Dor
3
3
  # :nodoc:
4
4
  module Resources
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spotlight-dor-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer