gdor-indexer 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +2 -1
- data/lib/gdor/indexer.rb +2 -1
- data/lib/gdor/indexer/public_xml_fields.rb +3 -3
- data/lib/gdor/indexer/version.rb +1 -1
- data/spec/unit/indexer_spec.rb +13 -0
- data/spec/unit/public_xml_fields_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5512304eceff43f6099aa3de8864b61d587a6cc
|
4
|
+
data.tar.gz: 3e9e662af728c9d6de0291bff59e9e1cf41b2173
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0caa4dada6bbde97f147b3630683ed6b689309fc78584ca1aba47eea7421980e7a0ac6835ab55cef50398e8b03d6eca4d480601ffe2ba567c2e399e8f9aa27d5
|
7
|
+
data.tar.gz: 2b3e81c2b3693f4722359ca80efbece1e15b05cd14226986ef1c6bc6578eadcea42a33f1ccb859281c035e3836b0eeed4c8948eeb1444e3f8530f09d910a1b38
|
data/.rubocop_todo.yml
CHANGED
data/lib/gdor/indexer.rb
CHANGED
@@ -39,6 +39,7 @@ module GDor
|
|
39
39
|
options = args.extract_options!
|
40
40
|
yml_path = args.first
|
41
41
|
|
42
|
+
@solr_client = options.delete(:solr_client)
|
42
43
|
@success_count = 0
|
43
44
|
@error_count = 0
|
44
45
|
@total_time_to_solr = 0
|
@@ -66,7 +67,7 @@ module GDor
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def solr_client
|
69
|
-
harvestdor.solr
|
70
|
+
@solr_client ||= harvestdor.solr
|
70
71
|
end
|
71
72
|
|
72
73
|
def metrics
|
@@ -29,11 +29,11 @@ module GDor::Indexer::PublicXmlFields
|
|
29
29
|
ids = []
|
30
30
|
if content_md
|
31
31
|
if display_type == 'image'
|
32
|
-
content_md.xpath('
|
32
|
+
content_md.root.xpath('resource[@type="image"]/file/@id').each do |node|
|
33
33
|
ids << node.text unless node.text.empty?
|
34
34
|
end
|
35
35
|
elsif display_type == 'file'
|
36
|
-
content_md.xpath('
|
36
|
+
content_md.root.xpath('resource/file/@id').each do |node|
|
37
37
|
ids << node.text unless node.text.empty?
|
38
38
|
end
|
39
39
|
end
|
@@ -61,7 +61,7 @@ module GDor::Indexer::PublicXmlFields
|
|
61
61
|
# @return [String]
|
62
62
|
def dor_content_type
|
63
63
|
@dor_content_type ||= begin
|
64
|
-
dct = content_md ? content_md.xpath('@type').text : nil
|
64
|
+
dct = content_md ? content_md.root.xpath('@type').text : nil
|
65
65
|
logger.error "#{druid} has no DOR content type (<contentMetadata> element may be missing type attribute)" if !dct || dct.empty?
|
66
66
|
dct
|
67
67
|
end
|
data/lib/gdor/indexer/version.rb
CHANGED
data/spec/unit/indexer_spec.rb
CHANGED
@@ -419,6 +419,19 @@ describe GDor::Indexer do
|
|
419
419
|
end
|
420
420
|
end
|
421
421
|
|
422
|
+
describe '#solr_client' do
|
423
|
+
it 'defaults to the harvestdor-configured client' do
|
424
|
+
expect(@indexer.solr_client).to eq @indexer.harvestdor.solr
|
425
|
+
end
|
426
|
+
|
427
|
+
it 'can be set as an option' do
|
428
|
+
solr_client = double
|
429
|
+
@indexer = described_class.new(solr_client: solr_client)
|
430
|
+
|
431
|
+
expect(@indexer.solr_client).to eq solr_client
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
422
435
|
# context "skip heartbeat" do
|
423
436
|
# it "allows me to use a fake url for dor-fetcher-client" do
|
424
437
|
# expect {GDor::Indexer.new(@config_yml_path)}.not_to raise_error
|
@@ -19,7 +19,7 @@ describe GDor::Indexer::PublicXmlFields do
|
|
19
19
|
|
20
20
|
def sdb_for_content_md(m)
|
21
21
|
resource = Harvestdor::Indexer::Resource.new(double, @fake_druid)
|
22
|
-
allow(resource).to receive(:content_metadata).and_return(Nokogiri::XML(m)
|
22
|
+
allow(resource).to receive(:content_metadata).and_return(Nokogiri::XML(m))
|
23
23
|
allow(resource).to receive(:public_xml).and_return(@empty_pub_xml)
|
24
24
|
allow(resource).to receive(:mods).and_return(@mods_xml)
|
25
25
|
GDor::Indexer::SolrDocBuilder.new(resource, logger)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gdor-indexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-10-
|
13
|
+
date: 2015-10-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: harvestdor-indexer
|