ddr-models 2.4.2 → 2.4.3

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: a1aeee77be1941cef872cdef9833e667f3e5c93e
4
- data.tar.gz: cf6d46b137d160d69bef0f300a7230f223f7d7fc
3
+ metadata.gz: 60aeffdbd5511ea08d1026c736a808724cc37032
4
+ data.tar.gz: ef4f116ab09428bb84892a0dda1116fa6398ca6e
5
5
  SHA512:
6
- metadata.gz: cbabe3f6c1a20248a908bd5b0e57f3ce6ac8bd3688d8dffa29008ed8a863fbafe0cc0c32a4183a3c908ca815af990982d2b284367f8f62a78880b1d49e96b366
7
- data.tar.gz: b8900cd65a8d06bfb1395cd36f975cb51b7228342713800443f050ee984a0d7d9a6579c2c9e759a012eb8e6c45fda1070cdc42aa3f8a887233dd9917880596b3
6
+ metadata.gz: 894a0941891ab5be56e3b2ad982f278a4128c7a9200860c13aa84d67dad1df801164af02ea338607aa486d5d02d7941a9b4ab50e700d5e043e87e391d9569f8e
7
+ data.tar.gz: 9bcfbb033acd735b78db25cab76bf76a9abc7485fd77cb22782be53efc19401434818d2c8bbbd91b225afca4f21b1ab3cdb15bcec7678fadeea121eb89c05ba3
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Models
3
- VERSION = "2.4.2"
3
+ VERSION = "2.4.3"
4
4
  end
5
5
  end
@@ -1,42 +1,54 @@
1
1
  module Ddr::Models
2
2
  RSpec.describe Indexing do
3
3
 
4
- let(:obj) { FactoryGirl.build(:item) }
4
+ subject { obj.index_fields }
5
5
 
6
- let(:role1) { FactoryGirl.build(:role, :curator, :person, :resource) }
7
- let(:role2) { FactoryGirl.build(:role, :curator, :person, :policy) }
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
- subject { obj.index_fields }
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
- before do
14
- obj.license = "cc-by-nc-nd-40"
15
- obj.rightsMetadata.license.title = ["License Title"]
16
- obj.rightsMetadata.license.description = ["License Description"]
17
- obj.rightsMetadata.license.url = ["http://library.duke.edu"]
18
- obj.local_id = "foo"
19
- obj.adminMetadata.doi << "http://doi.org/10.1000/182"
20
- obj.permanent_id = "ark:/99999/fk4zzz"
21
- obj.permanent_url = "http://id.library.duke.edu/ark:/99999/fk4zzz"
22
- obj.display_format = "Image"
23
- obj.roles.grant role1, role2, role3, role4
24
- obj.aspace_id = "aspace_dccea43034e1b8261e14cf999e86449d"
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
- its([Indexing::LICENSE]) { is_expected.to eq("cc-by-nc-nd-40") }
28
- its([Indexing::LICENSE_TITLE]) { is_expected.to eq("License Title") }
29
- its([Indexing::LICENSE_DESCRIPTION]) { is_expected.to eq("License Description") }
30
- its([Indexing::LICENSE_URL]) { is_expected.to eq("http://library.duke.edu") }
31
- its([Indexing::LOCAL_ID]) { is_expected.to eq("foo") }
32
- its([Indexing::DOI]) { is_expected.to eq(["http://doi.org/10.1000/182"]) }
33
- its([Indexing::PERMANENT_ID]) { is_expected.to eq("ark:/99999/fk4zzz") }
34
- its([Indexing::PERMANENT_URL]) { is_expected.to eq("http://id.library.duke.edu/ark:/99999/fk4zzz") }
35
- its([Indexing::DISPLAY_FORMAT]) { is_expected.to eq("Image") }
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.2
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-22 00:00:00.000000000 Z
12
+ date: 2016-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails