solr_ead 0.2.0 → 0.3.0
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.
- data/Gemfile.lock +1 -2
- data/config/solr.yml +4 -4
- data/lib/ead_mapper.rb +10 -19
- data/lib/solr_ead/behaviors.rb +9 -9
- data/lib/solr_ead/component.rb +59 -42
- data/lib/solr_ead/document.rb +16 -3
- data/lib/solr_ead/indexer.rb +2 -2
- data/lib/solr_ead/version.rb +1 -1
- data/spec/behaviors_spec.rb +0 -18
- data/spec/component_spec.rb +10 -12
- data/spec/document_spec.rb +11 -18
- data/spec/indexer_spec.rb +6 -5
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
solr_ead (0.0
|
4
|
+
solr_ead (0.2.0)
|
5
5
|
om (~> 1.8.0)
|
6
6
|
rsolr
|
7
7
|
sanitize
|
@@ -55,7 +55,6 @@ GEM
|
|
55
55
|
rspec-mocks (2.12.0)
|
56
56
|
sanitize (2.0.3)
|
57
57
|
nokogiri (>= 1.4.4, < 1.6)
|
58
|
-
nokogiri (>= 1.4.4, < 1.6)
|
59
58
|
solrizer (2.0.0)
|
60
59
|
daemons
|
61
60
|
mediashelf-loggable (~> 0.4.7)
|
data/config/solr.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
development:
|
2
|
-
url: http://
|
3
|
-
test: &
|
4
|
-
url: http://
|
2
|
+
url: http://127.0.0.1:8985/solr/blacklight-dev
|
3
|
+
test: &test
|
4
|
+
url: http://127.0.0.1:8985/solr/blacklight-dev
|
5
5
|
production:
|
6
|
-
url: http://
|
6
|
+
url: http://127.0.0.1:8985/solr/blacklight-dev
|
data/lib/ead_mapper.rb
CHANGED
@@ -1,22 +1,13 @@
|
|
1
1
|
class EadMapper < Solrizer::FieldMapper
|
2
|
-
|
3
2
|
id_field 'id'
|
4
|
-
index_as :
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
t.double :suffix => '_d'
|
15
|
-
end
|
16
|
-
index_as :displayable, :suffix => '_display'
|
17
|
-
index_as :facetable, :suffix => '_facet'
|
18
|
-
index_as :sortable, :suffix => '_sort'
|
19
|
-
index_as :unstemmed_searchable, :suffix => '_unstem_search'
|
20
|
-
index_as :string, :suffix => '_s'
|
21
|
-
index_as :z, :suffix => '_z'
|
3
|
+
index_as :displayable, :suffix => '_display'
|
4
|
+
index_as :searchable, :suffix => '_t'
|
5
|
+
index_as :unstemmed, :suffix => '_unstem_search'
|
6
|
+
index_as :string, :suffix => '_s'
|
7
|
+
index_as :date, :suffix => '_dt'
|
8
|
+
index_as :integer, :suffix => '_i'
|
9
|
+
index_as :boolean, :suffix => '_b'
|
10
|
+
index_as :facetable, :suffix => '_facet'
|
11
|
+
index_as :sortable, :suffix => '_sort'
|
12
|
+
index_as :keyed, :suffix => '_id'
|
22
13
|
end
|
data/lib/solr_ead/behaviors.rb
CHANGED
@@ -47,25 +47,25 @@ module SolrEad::Behaviors
|
|
47
47
|
# The solr fields returned by this method are:
|
48
48
|
#
|
49
49
|
# id:: Unique identifier using the id attribute and the <eadid>
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# parent_unittitles_display::
|
50
|
+
# ead_id:: The <eadid> node of the ead. This is so we know which ead this component belongs to.
|
51
|
+
# parent_id:: The id attribute of the parent <c> node
|
52
|
+
# parent_id_s:: Array of all the parent component ids for a given component.
|
53
|
+
# parent_unittitles_display:: Array of title fields for all the parent components of a given component.
|
54
54
|
# component_level_i:: numeric level of the component
|
55
55
|
# component_children_b:: Boolean field indicating whether or not the component has any child <c> nodes attached to it
|
56
|
-
#
|
56
|
+
# collection_facet:: Title field of the ead document so we can facet on all components in a collection
|
57
57
|
#
|
58
58
|
# These fields are used so that we may reconstruct placement of a single component
|
59
59
|
# within the hierarchy of the original ead.
|
60
60
|
def additional_component_fields(node, addl_fields = Hash.new)
|
61
61
|
addl_fields["id"] = [node.xpath("//eadid").text, node.attr("id")].join
|
62
|
-
addl_fields["
|
63
|
-
addl_fields["
|
64
|
-
addl_fields["
|
62
|
+
addl_fields["ead_id"] = node.xpath("//eadid").text
|
63
|
+
addl_fields["parent_id"] = node.parent.attr("id") unless node.parent.attr("id").nil?
|
64
|
+
addl_fields["parent_id_s"] = parent_id_list(node)
|
65
65
|
addl_fields["parent_unittitles_display"] = parent_unittitle_list(node)
|
66
66
|
addl_fields["component_level_i"] = parent_id_list(node).length + 1
|
67
67
|
addl_fields["component_children_b"] = component_children?(node)
|
68
|
-
addl_fields["
|
68
|
+
addl_fields["collection_facet"] = node.xpath("//archdesc/did/unittitle").text
|
69
69
|
return addl_fields
|
70
70
|
end
|
71
71
|
|
data/lib/solr_ead/component.rb
CHANGED
@@ -6,12 +6,13 @@ class SolrEad::Component
|
|
6
6
|
# Define each term in your ead that you want put into the solr document
|
7
7
|
set_terminology do |t|
|
8
8
|
t.root(:path=>"c")
|
9
|
-
t.ref_(:path=>"/c/@id"
|
10
|
-
t.level(:path=>"/c/@level", :index_as
|
9
|
+
t.ref_(:path=>"/c/@id")
|
10
|
+
t.level(:path=>"/c/@level", :index_as=>[:facetable])
|
11
11
|
|
12
|
-
t.title(:path=>"unittitle", :attributes=>{ :type => :none }, :index_as=>[:
|
12
|
+
t.title(:path=>"unittitle", :attributes=>{ :type => :none }, :index_as=>[:displayable])
|
13
|
+
t.unitdate(:index_as=>[:displayable])
|
13
14
|
|
14
|
-
#
|
15
|
+
# Facets
|
15
16
|
t.corpname(:index_as=>[:facetable])
|
16
17
|
t.famname(:index_as=>[:facetable])
|
17
18
|
t.genreform(:index_as=>[:facetable])
|
@@ -20,56 +21,72 @@ class SolrEad::Component
|
|
20
21
|
t.persname(:index_as=>[:facetable])
|
21
22
|
t.subject(:index_as=>[:facetable])
|
22
23
|
|
23
|
-
# Archival material
|
24
|
-
t.container(:attributes=>{ :type => "Box" }) {
|
25
|
-
t.label(:path=>{ :attribute=>"label" })
|
26
|
-
}
|
27
|
-
t.material(:proxy=>[:container, :label], :index_as => [:facetable])
|
28
|
-
|
29
24
|
# These terms are proxied to match with Blacklight's default facets, but otherwise
|
30
25
|
# you can remove them or rename the above facet terms to match with your solr
|
31
26
|
# implementation.
|
32
27
|
t.subject_geo(:proxy=>[:geogname])
|
33
28
|
t.subject_topic(:proxy=>[:subject])
|
34
29
|
|
35
|
-
|
36
|
-
t.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
t.
|
42
|
-
t.
|
43
|
-
t.
|
44
|
-
t.
|
45
|
-
t.
|
46
|
-
t.
|
47
|
-
t.
|
48
|
-
t.
|
49
|
-
|
50
|
-
|
51
|
-
t.
|
52
|
-
t.
|
53
|
-
t.
|
54
|
-
t.
|
55
|
-
t.
|
56
|
-
t.
|
57
|
-
t.
|
58
|
-
t.
|
59
|
-
t.
|
60
|
-
t.
|
61
|
-
t.
|
62
|
-
t.
|
63
|
-
t.
|
64
|
-
t.
|
30
|
+
# Item
|
31
|
+
t.container {
|
32
|
+
t.label(:path => {:attribute=>"label"})
|
33
|
+
t.type(:path => {:attribute=>"type"})
|
34
|
+
t.id(:path => {:attribute=>"id"})
|
35
|
+
}
|
36
|
+
t.container_label(:proxy=>[:container, :label])
|
37
|
+
t.container_type(:proxy=>[:container, :type])
|
38
|
+
t.container_id(:proxy=>[:container, :id])
|
39
|
+
t.material(:proxy=>[:container, :label], :index_as=>[:facetable])
|
40
|
+
t.physdesc(:path=>"did/physdesc[not(dimensions)]", :index_as=>[:displayable])
|
41
|
+
t.dimensions(:path=>"did/physdesc/dimensions", :index_as=>[:displayable])
|
42
|
+
t.langcode(:path=>"did/langmaterial/language/@langcode")
|
43
|
+
t.language(:path=>"did/langmaterial", :index_as=>[:displayable])
|
44
|
+
|
45
|
+
# Description
|
46
|
+
t.accessrestrict(:path=>"accessrestrict/p", :index_as=>[:displayable])
|
47
|
+
t.accessrestrict_heading(:path=>"accessrestrict/head")
|
48
|
+
t.accruals(:path=>"accruals/p", :index_as=>[:displayable])
|
49
|
+
t.accruals_heading(:path=>"accruals/head")
|
50
|
+
t.acqinfo(:path=>"acqinfo/p", :index_as=>[:displayable])
|
51
|
+
t.acqinfo_heading(:path=>"acqinfo/head")
|
52
|
+
t.altformavail(:path=>"altformavail/p", :index_as=>[:displayable])
|
53
|
+
t.altformavail_heading(:path=>"altformavail/head")
|
54
|
+
t.appraisal(:path=>"appraisal/p", :index_as=>[:displayable])
|
55
|
+
t.appraisal_heading(:path=>"appraisal/head")
|
56
|
+
t.arrangement(:path=>"arrangement/p", :index_as=>[:displayable])
|
57
|
+
t.arrangement_heading(:path=>"arrangement/head")
|
58
|
+
t.custodhist(:path=>"custodhist/p", :index_as=>[:displayable])
|
59
|
+
t.custodhist_heading(:path=>"custodhist/head")
|
60
|
+
t.fileplan(:path=>"fileplan/p", :index_as=>[:displayable])
|
61
|
+
t.fileplan_heading(:path=>"fileplan/head")
|
62
|
+
t.originalsloc(:path=>"originalsloc/p", :index_as=>[:displayable])
|
63
|
+
t.originalsloc_heading(:path=>"originalsloc/head")
|
64
|
+
t.phystech(:path=>"phystech/p", :index_as=>[:displayable])
|
65
|
+
t.phystech_heading(:path=>"phystech/head")
|
66
|
+
t.processinfo(:path=>"processinfo/p", :index_as=>[:displayable])
|
67
|
+
t.processinfo_heading(:path=>"processinfo/head")
|
68
|
+
t.relatedmaterial(:path=>"relatedmaterial/p", :index_as=>[:displayable])
|
69
|
+
t.relatedmaterial_heading(:path=>"relatedmaterial/head")
|
70
|
+
t.separatedmaterial(:path=>"separatedmaterial/p", :index_as=>[:displayable])
|
71
|
+
t.separatedmaterial_heading(:path=>"separatedmaterial/head")
|
72
|
+
t.scopecontent(:path=>"scopecontent/p", :index_as=>[:displayable])
|
73
|
+
t.scopecontent_heading(:path=>"scopecontent/head")
|
74
|
+
t.userestrict(:path=>"userestrict/p", :index_as=>[:displayable])
|
75
|
+
t.userestrict_heading(:path=>"userestrict/head")
|
76
|
+
|
77
|
+
# <odd> nodes
|
78
|
+
# These guys depend on what's in <head> so we do some xpathy stuff...
|
79
|
+
t.note(:path=>'odd[./head="General note"]/p', :index_as=>[:displayable])
|
80
|
+
t.accession(:path=>'odd[./head[starts-with(.,"Museum Accession")]]/p', :index_as=>[:displayable])
|
81
|
+
t.print_run(:path=>'odd[./head[starts-with(.,"Limited")]]/p', :index_as=>[:displayable])
|
65
82
|
|
66
83
|
end
|
67
84
|
|
68
85
|
def to_solr(solr_doc = Hash.new)
|
69
86
|
super(solr_doc)
|
70
|
-
solr_doc.merge!({"format"
|
87
|
+
solr_doc.merge!({"format" => "Archival Item"})
|
71
88
|
solr_doc["parent_unittitles_display"].length > 0 ? solr_doc.merge!({"heading_display" => [ solr_doc["parent_unittitles_display"], self.title.first].join(" >> ") }) : solr_doc.merge!({"heading_display" => self.title.first })
|
72
|
-
solr_doc.merge!({"
|
89
|
+
solr_doc.merge!({"ref_id" => self.ref.first})
|
73
90
|
end
|
74
91
|
|
75
92
|
end
|
data/lib/solr_ead/document.rb
CHANGED
@@ -23,8 +23,19 @@ class SolrEad::Document
|
|
23
23
|
t.subject_geo(:proxy=>[:geogname])
|
24
24
|
t.subject_topic(:proxy=>[:subject])
|
25
25
|
|
26
|
-
t.title(:path=>"
|
26
|
+
t.title(:path=>"archdesc/did/unittitle", :index_as=>[:searchable, :displayable])
|
27
27
|
t.title_filing(:path=>"titleproper", :attributes=>{ :type => "filing" }, :index_as=>[:sortable])
|
28
|
+
t.title_num(:path=>"archdesc/did/unitid")
|
29
|
+
t.extent(:path=>"archdesc/did/physdesc/extent")
|
30
|
+
t.unitdate(:path=>"archdesc/did/unitdate[not(@type)]", :index_as=>[:unstemmed])
|
31
|
+
t.unitdate_bulk(:path=>"archdesc/did/unitdate[@type='bulk']", :index_as=>[:unstemmed])
|
32
|
+
t.unitdate_inclusive(:path=>"archdesc/did/unitdate[@type='inclusive']", :index_as=>[:unstemmed])
|
33
|
+
t.language(:path=>"archdesc/did/langmaterial", :index_as=>[:displayable])
|
34
|
+
t.langcode(:path=>"did/langmaterial/language/@langcode")
|
35
|
+
t.abstract(:path=>"archdesc/did/abstract", :index_as=>[:searchable])
|
36
|
+
|
37
|
+
t.collection(:proxy=>[:title], :index_as=>[:facetable])
|
38
|
+
|
28
39
|
|
29
40
|
# General field available within archdesc
|
30
41
|
t.accessrestrict(:path=>"archdesc/accessrestrict/p", :index_as=>[:searchable])
|
@@ -39,6 +50,8 @@ class SolrEad::Document
|
|
39
50
|
t.appraisal_heading(:path=>"archdesc/appraisal/head", :index_as=>[:displayable])
|
40
51
|
t.arrangement(:path=>"archdesc/arrangement/p", :index_as=>[:searchable])
|
41
52
|
t.arrangement_heading(:path=>"archdesc/arrangement/head", :index_as=>[:displayable])
|
53
|
+
t.bioghist(:path=>"archdesc/bioghist/p", :index_as=>[:searchable])
|
54
|
+
t.bioghist_heading(:path=>"archdesc/bioghist/head", :index_as=>[:displayable])
|
42
55
|
t.custodhist(:path=>"archdesc/custodhist/p", :index_as=>[:searchable])
|
43
56
|
t.custodhist_heading(:path=>"archdesc/custodhist/head", :index_as=>[:displayable])
|
44
57
|
t.fileplan(:path=>"archdesc/fileplan/p", :index_as=>[:searchable])
|
@@ -63,9 +76,9 @@ class SolrEad::Document
|
|
63
76
|
def to_solr(solr_doc = Hash.new)
|
64
77
|
super(solr_doc)
|
65
78
|
solr_doc.merge!({"id" => self.eadid.first})
|
66
|
-
solr_doc.merge!({"
|
79
|
+
solr_doc.merge!({"ead_id" => self.eadid.first})
|
67
80
|
solr_doc.merge!({"format" => "Archival Collection"})
|
68
|
-
solr_doc.merge!({"heading_display" => ("Guide to the " + self.title.first)})
|
81
|
+
solr_doc.merge!({"heading_display" => ("Guide to the " + self.title.first + " (" + self.title_num.first + ")")}) unless self.title_num.empty?
|
69
82
|
return solr_doc
|
70
83
|
end
|
71
84
|
|
data/lib/solr_ead/indexer.rb
CHANGED
@@ -68,7 +68,7 @@ class Indexer
|
|
68
68
|
def update(file)
|
69
69
|
doc = om_document(File.new(file))
|
70
70
|
solr_doc = doc.to_solr
|
71
|
-
solr.delete_by_query( '
|
71
|
+
solr.delete_by_query( 'ead_id:"' + solr_doc["id"] + '"' )
|
72
72
|
solr.add solr_doc
|
73
73
|
add_components(file) unless options[:simple]
|
74
74
|
solr.commit
|
@@ -77,7 +77,7 @@ class Indexer
|
|
77
77
|
# Deletes the ead document and any component documents from your solr index and
|
78
78
|
# commits the results.
|
79
79
|
def delete(id)
|
80
|
-
solr.delete_by_query( '
|
80
|
+
solr.delete_by_query( 'ead_id:"' + id + '"')
|
81
81
|
solr.commit
|
82
82
|
end
|
83
83
|
|
data/lib/solr_ead/version.rb
CHANGED
data/spec/behaviors_spec.rb
CHANGED
@@ -82,24 +82,6 @@ describe SolrEad::Behaviors do
|
|
82
82
|
@test.component_children?(node.elements.first).should be_false
|
83
83
|
end
|
84
84
|
|
85
|
-
it "should return true for series-level components" do
|
86
|
-
pending "This is an old test"
|
87
|
-
["series","subseries"].each do |level|
|
88
|
-
xml = '<c id="ref42" level="' + level +'"></c>'
|
89
|
-
node = Nokogiri::XML(xml)
|
90
|
-
@test.component_children?(node.elements.first).should be_true
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should return false for item-level components" do
|
95
|
-
pending "This is an old test"
|
96
|
-
["file","item"].each do |level|
|
97
|
-
xml = '<c id="ref42" level="' + level +'"></c>'
|
98
|
-
node = Nokogiri::XML(xml)
|
99
|
-
@test.component_children?(node.elements.first).should be_false
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
85
|
end
|
104
86
|
|
105
87
|
end
|
data/spec/component_spec.rb
CHANGED
@@ -13,10 +13,10 @@ describe SolrEad::Component do
|
|
13
13
|
|
14
14
|
before :each do
|
15
15
|
additional_fields = {
|
16
|
-
"id" => "TEST-
|
17
|
-
"
|
18
|
-
"
|
19
|
-
"
|
16
|
+
"id" => "TEST-0001ref010",
|
17
|
+
"ead_id" => "TEST-0001",
|
18
|
+
"parent_id" => "ref001",
|
19
|
+
"parent_id_s" => ["ref001", "ref002", "ref003"],
|
20
20
|
"parent_unittitles_display" => ["Series I", "Subseries A", "Subseries 1"],
|
21
21
|
"component_children_b" => FALSE
|
22
22
|
}
|
@@ -24,22 +24,21 @@ describe SolrEad::Component do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should accept additional fields from a hash" do
|
27
|
-
@solr_doc["id"].should == "TEST-
|
27
|
+
@solr_doc["id"].should == "TEST-0001ref010"
|
28
28
|
@solr_doc["level_facet"].should include "item"
|
29
29
|
@solr_doc["heading_display"].should == "Series I >> Subseries A >> Subseries 1 >> Internal Revenue Service Form Information Return [RESTRICTED]"
|
30
|
-
@solr_doc["
|
31
|
-
@solr_doc["accessrestrict_heading_display"].should include "Access Restrictions"
|
30
|
+
@solr_doc["accessrestrict_display"].first.should match /^This item .* is available.$/
|
32
31
|
end
|
33
32
|
|
34
33
|
it "should create fields using type" do
|
35
|
-
@solr_doc["
|
34
|
+
@solr_doc["ref_id"].should == "ref215"
|
36
35
|
end
|
37
36
|
|
38
37
|
end
|
39
38
|
|
40
39
|
it "should format heading_display with only one element" do
|
41
40
|
additional_fields = {
|
42
|
-
"id" => "TEST-
|
41
|
+
"id" => "TEST-0001ref010",
|
43
42
|
"eadid_s" => "TEST-0001",
|
44
43
|
"parent_id_s" => "ref001",
|
45
44
|
"parent_ids_display" => ["ref001", "ref002", "ref003"],
|
@@ -47,11 +46,10 @@ describe SolrEad::Component do
|
|
47
46
|
"component_children_b" => FALSE
|
48
47
|
}
|
49
48
|
solr_doc = @doc.to_solr(additional_fields)
|
50
|
-
solr_doc["id"].should == "TEST-
|
49
|
+
solr_doc["id"].should == "TEST-0001ref010"
|
51
50
|
solr_doc["level_facet"].should include "item"
|
52
51
|
solr_doc["heading_display"].should == "Internal Revenue Service Form Information Return [RESTRICTED]"
|
53
|
-
solr_doc["
|
54
|
-
solr_doc["accessrestrict_heading_display"].should include "Access Restrictions"
|
52
|
+
solr_doc["accessrestrict_display"].first.should match /^This item .* is available.$/
|
55
53
|
end
|
56
54
|
|
57
55
|
end
|
data/spec/document_spec.rb
CHANGED
@@ -20,15 +20,15 @@ describe SolrEad::Document do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should have some subject headings" do
|
23
|
-
@ex1.persname.should
|
23
|
+
@ex1.persname.should include "Cochran, Eddie, 1938-1960"
|
24
24
|
@ex1.genreform.should include "Newspapers"
|
25
|
-
@ex1.subject.should
|
26
|
-
@ex2.corpname.should
|
25
|
+
@ex1.subject.should include "Rockabilly music"
|
26
|
+
@ex2.corpname.should include "Tuskegee Normal and Industrial Institute--1880-1940."
|
27
27
|
@ex2.genreform.should include "Group portraits--1880-1940."
|
28
|
-
@ex2.geogname.should
|
29
|
-
@ex2.name.should
|
30
|
-
@ex2.persname.should
|
31
|
-
@ex2.subject.should
|
28
|
+
@ex2.geogname.should include "Washington, D.C."
|
29
|
+
@ex2.name.should include "Bell, J.S., Portland, OR"
|
30
|
+
@ex2.persname.should include "Johnston, Frances Benjamin, 1864-1952, photographer."
|
31
|
+
@ex2.subject.should include "Buildings--1880-1940."
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should have scope and contents" do
|
@@ -49,10 +49,10 @@ describe SolrEad::Document do
|
|
49
49
|
describe ".to_solr" do
|
50
50
|
|
51
51
|
it "should have the appropriate id fields" do
|
52
|
-
@solr_ex1["
|
53
|
-
@solr_ex1["id"].should
|
54
|
-
@solr_ex2["
|
55
|
-
@solr_ex2["id"].should
|
52
|
+
@solr_ex1["ead_id"].should == "ARC-0005"
|
53
|
+
@solr_ex1["id"].should == "ARC-0005"
|
54
|
+
@solr_ex2["ead_id"].should == "http://hdl.loc.gov/loc.pnp/eadpnp.pp002010"
|
55
|
+
@solr_ex2["id"].should == "http://hdl.loc.gov/loc.pnp/eadpnp.pp002010"
|
56
56
|
|
57
57
|
end
|
58
58
|
|
@@ -68,13 +68,6 @@ describe SolrEad::Document do
|
|
68
68
|
@solr_ex2["subject_facet"].should include "Buildings--1880-1940."
|
69
69
|
end
|
70
70
|
|
71
|
-
it "should index head tags as display and p tags as text" do
|
72
|
-
@solr_ex1["separatedmaterial_heading_display"].should include "Separated Materials"
|
73
|
-
@solr_ex1["separatedmaterial_t"].first.should match /^Commercially-released publications.*materials are available.$/
|
74
|
-
@solr_ex2["scopecontent_heading_display"].should include "Scope and Content Note"
|
75
|
-
@solr_ex2["scopecontent_t"].first.should match /^Photographs/
|
76
|
-
end
|
77
|
-
|
78
71
|
end
|
79
72
|
|
80
73
|
end
|
data/spec/indexer_spec.rb
CHANGED
@@ -14,20 +14,20 @@ describe SolrEad::Indexer do
|
|
14
14
|
|
15
15
|
it "should index a new ead from a file" do
|
16
16
|
@indexer.create(@file)
|
17
|
-
q = @indexer.solr.get 'select', :params => {:q=>'
|
17
|
+
q = @indexer.solr.get 'select', :params => {:q=>'ead_id:"ARC-0005"', :qt=>'document'}
|
18
18
|
q["response"]["numFound"].should == 136
|
19
19
|
end
|
20
20
|
|
21
21
|
|
22
22
|
it "should update an ead from a file" do
|
23
23
|
@indexer.update(@file)
|
24
|
-
q = @indexer.solr.get 'select', :params => {:q=>'
|
24
|
+
q = @indexer.solr.get 'select', :params => {:q=>'ead_id:"ARC-0005"', :qt=>'document'}
|
25
25
|
q["response"]["numFound"].should == 136
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should delete and ead give an id" do
|
29
29
|
@indexer.delete("ARC-0005")
|
30
|
-
q = @indexer.solr.get 'select', :params => {:q=>'
|
30
|
+
q = @indexer.solr.get 'select', :params => {:q=>'ead_id:"ARC-0005"', :qt=>'document'}
|
31
31
|
q["response"]["numFound"].should == 0
|
32
32
|
end
|
33
33
|
|
@@ -45,13 +45,13 @@ describe SolrEad::Indexer do
|
|
45
45
|
|
46
46
|
it "should index a new ead from a file as a single solr document" do
|
47
47
|
@simple_indexer.create(@file)
|
48
|
-
q = @simple_indexer.solr.get 'select', :params => {:q=>'
|
48
|
+
q = @simple_indexer.solr.get 'select', :params => {:q=>'ead_id:"ARC-0005"', :qt=>'document'}
|
49
49
|
q["response"]["numFound"].should == 1
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should delete a single ead" do
|
53
53
|
@simple_indexer.delete("ARC-0005")
|
54
|
-
q = @simple_indexer.solr.get 'select', :params => {:q=>'
|
54
|
+
q = @simple_indexer.solr.get 'select', :params => {:q=>'ead_id:"ARC-0005"', :qt=>'document'}
|
55
55
|
q["response"]["numFound"].should == 0
|
56
56
|
end
|
57
57
|
|
@@ -68,6 +68,7 @@ describe SolrEad::Indexer do
|
|
68
68
|
t.root(:path=>"ead", :index_as => [:not_searchable])
|
69
69
|
t.title
|
70
70
|
t.eadid
|
71
|
+
t.title_num
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solr_ead
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: om
|