ddr-models 2.4.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ddr/index/fields.rb +1 -0
- data/lib/ddr/models/indexing.rb +3 -0
- data/lib/ddr/models/version.rb +1 -1
- data/spec/models/indexing_spec.rb +43 -31
- 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: 60aeffdbd5511ea08d1026c736a808724cc37032
|
4
|
+
data.tar.gz: ef4f116ab09428bb84892a0dda1116fa6398ca6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 894a0941891ab5be56e3b2ad982f278a4128c7a9200860c13aa84d67dad1df801164af02ea338607aa486d5d02d7941a9b4ab50e700d5e043e87e391d9569f8e
|
7
|
+
data.tar.gz: 9bcfbb033acd735b78db25cab76bf76a9abc7485fd77cb22782be53efc19401434818d2c8bbbd91b225afca4f21b1ab3cdb15bcec7678fadeea121eb89c05ba3
|
data/lib/ddr/index/fields.rb
CHANGED
@@ -13,6 +13,7 @@ module Ddr::Index
|
|
13
13
|
COLLECTION_FACET = Field.new :collection_facet, :facetable
|
14
14
|
COLLECTION_URI = Field.new :collection_uri, :symbol
|
15
15
|
CONTENT_CONTROL_GROUP = Field.new :content_control_group, :searchable, type: :string
|
16
|
+
CONTENT_CREATE_DATE = Field.new :content_create_date, :stored_sortable, type: :date
|
16
17
|
CONTENT_SIZE = Field.new :content_size, solr_name: "content_size_lsi"
|
17
18
|
CONTENT_SIZE_HUMAN = Field.new :content_size_human, :symbol
|
18
19
|
CONTRIBUTOR_FACET = Field.new :contributor_facet, :facetable
|
data/lib/ddr/models/indexing.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
1
3
|
module Ddr
|
2
4
|
module Models
|
3
5
|
module Indexing
|
@@ -57,6 +59,7 @@ module Ddr
|
|
57
59
|
fields.merge!(last_virus_check.to_solr) if last_virus_check
|
58
60
|
end
|
59
61
|
if has_content?
|
62
|
+
fields[CONTENT_CREATE_DATE] = Ddr::Utils.solr_date(content.createDate)
|
60
63
|
fields[CONTENT_CONTROL_GROUP] = content.controlGroup
|
61
64
|
fields[CONTENT_SIZE] = content_size
|
62
65
|
fields[CONTENT_SIZE_HUMAN] = content_human_size
|
data/lib/ddr/models/version.rb
CHANGED
@@ -1,42 +1,54 @@
|
|
1
1
|
module Ddr::Models
|
2
2
|
RSpec.describe Indexing do
|
3
3
|
|
4
|
-
|
4
|
+
subject { obj.index_fields }
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
let(:role3) { FactoryGirl.build(:role, :editor, :group, :policy) }
|
9
|
-
let(:role4) { FactoryGirl.build(:role, :editor, :person, :policy) }
|
6
|
+
describe "general indexing" do
|
7
|
+
let(:obj) { FactoryGirl.build(:item) }
|
10
8
|
|
11
|
-
|
9
|
+
let(:role1) { FactoryGirl.build(:role, :curator, :person, :resource) }
|
10
|
+
let(:role2) { FactoryGirl.build(:role, :curator, :person, :policy) }
|
11
|
+
let(:role3) { FactoryGirl.build(:role, :editor, :group, :policy) }
|
12
|
+
let(:role4) { FactoryGirl.build(:role, :editor, :person, :policy) }
|
13
|
+
|
14
|
+
before do
|
15
|
+
obj.license = "cc-by-nc-nd-40"
|
16
|
+
obj.rightsMetadata.license.title = ["License Title"]
|
17
|
+
obj.rightsMetadata.license.description = ["License Description"]
|
18
|
+
obj.rightsMetadata.license.url = ["http://library.duke.edu"]
|
19
|
+
obj.local_id = "foo"
|
20
|
+
obj.adminMetadata.doi << "http://doi.org/10.1000/182"
|
21
|
+
obj.permanent_id = "ark:/99999/fk4zzz"
|
22
|
+
obj.permanent_url = "http://id.library.duke.edu/ark:/99999/fk4zzz"
|
23
|
+
obj.display_format = "Image"
|
24
|
+
obj.roles.grant role1, role2, role3, role4
|
25
|
+
obj.aspace_id = "aspace_dccea43034e1b8261e14cf999e86449d"
|
26
|
+
end
|
12
27
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
obj.
|
23
|
-
|
24
|
-
|
28
|
+
its([Indexing::LICENSE]) { is_expected.to eq("cc-by-nc-nd-40") }
|
29
|
+
its([Indexing::LICENSE_TITLE]) { is_expected.to eq("License Title") }
|
30
|
+
its([Indexing::LICENSE_DESCRIPTION]) { is_expected.to eq("License Description") }
|
31
|
+
its([Indexing::LICENSE_URL]) { is_expected.to eq("http://library.duke.edu") }
|
32
|
+
its([Indexing::LOCAL_ID]) { is_expected.to eq("foo") }
|
33
|
+
its([Indexing::DOI]) { is_expected.to eq(["http://doi.org/10.1000/182"]) }
|
34
|
+
its([Indexing::PERMANENT_ID]) { is_expected.to eq("ark:/99999/fk4zzz") }
|
35
|
+
its([Indexing::PERMANENT_URL]) { is_expected.to eq("http://id.library.duke.edu/ark:/99999/fk4zzz") }
|
36
|
+
its([Indexing::DISPLAY_FORMAT]) { is_expected.to eq("Image") }
|
37
|
+
its([Indexing::ACCESS_ROLE]) { is_expected.to eq(obj.roles.to_json) }
|
38
|
+
its([Indexing::POLICY_ROLE]) { is_expected.to contain_exactly(role2.agent.first, role3.agent.first, role4.agent.first) }
|
39
|
+
its([Indexing::RESOURCE_ROLE]) { is_expected.to contain_exactly(role1.agent.first) }
|
40
|
+
its([Indexing::ASPACE_ID]) { is_expected.to eq("aspace_dccea43034e1b8261e14cf999e86449d") }
|
25
41
|
end
|
26
42
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
its([Indexing::ACCESS_ROLE]) { is_expected.to eq(obj.roles.to_json) }
|
37
|
-
its([Indexing::POLICY_ROLE]) { is_expected.to contain_exactly(role2.agent.first, role3.agent.first, role4.agent.first) }
|
38
|
-
its([Indexing::RESOURCE_ROLE]) { is_expected.to contain_exactly(role1.agent.first) }
|
39
|
-
its([Indexing::ASPACE_ID]) { is_expected.to eq("aspace_dccea43034e1b8261e14cf999e86449d") }
|
43
|
+
describe "content-bearing object indexing" do
|
44
|
+
let(:obj) { FactoryGirl.create(:component) }
|
45
|
+
let!(:create_date) { Time.parse("2016-01-22T21:50:33Z") }
|
46
|
+
before {
|
47
|
+
allow(obj.content).to receive(:createDate) { create_date }
|
48
|
+
}
|
49
|
+
|
50
|
+
its([Indexing::CONTENT_CREATE_DATE]) { is_expected.to eq "2016-01-22T21:50:33Z" }
|
51
|
+
end
|
40
52
|
|
41
53
|
end
|
42
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-01-
|
12
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|