solr_ead 0.3.1 → 0.3.2
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 +17 -16
- data/README.md +25 -5
- data/lib/solr_ead/component.rb +1 -1
- data/lib/solr_ead/document.rb +4 -2
- data/lib/solr_ead/indexer.rb +1 -0
- data/lib/solr_ead/version.rb +1 -1
- data/lib/solr_ead.rb +0 -1
- data/lib/tasks/solr_ead.rake +0 -2
- data/solr_ead.gemspec +2 -2
- data/spec/document_spec.rb +7 -0
- data/spec/fixtures/ARC-0161.xml +1508 -0
- metadata +10 -9
- data/lib/terminology_based_solrizer.rb +0 -9
data/Gemfile.lock
CHANGED
@@ -1,39 +1,39 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
solr_ead (0.2
|
5
|
-
om
|
4
|
+
solr_ead (0.3.2)
|
5
|
+
om
|
6
6
|
rsolr
|
7
7
|
sanitize
|
8
|
-
solrizer (~> 2.0.
|
8
|
+
solrizer (~> 2.1.0.rc1)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activemodel (3.2.
|
14
|
-
activesupport (= 3.2.
|
13
|
+
activemodel (3.2.11)
|
14
|
+
activesupport (= 3.2.11)
|
15
15
|
builder (~> 3.0.0)
|
16
|
-
activesupport (3.2.
|
16
|
+
activesupport (3.2.11)
|
17
17
|
i18n (~> 0.6)
|
18
18
|
multi_json (~> 1.0)
|
19
19
|
builder (3.0.4)
|
20
20
|
columnize (0.3.6)
|
21
21
|
daemons (1.1.9)
|
22
|
-
debugger (1.2.
|
22
|
+
debugger (1.2.3)
|
23
23
|
columnize (>= 0.3.1)
|
24
24
|
debugger-linecache (~> 1.1.1)
|
25
25
|
debugger-ruby_core_source (~> 1.1.5)
|
26
26
|
debugger-linecache (1.1.2)
|
27
27
|
debugger-ruby_core_source (>= 1.1.1)
|
28
|
-
debugger-ruby_core_source (1.1.
|
28
|
+
debugger-ruby_core_source (1.1.6)
|
29
29
|
deprecation (0.0.5)
|
30
30
|
activesupport
|
31
31
|
diff-lcs (1.1.3)
|
32
32
|
i18n (0.6.1)
|
33
|
-
json (1.7.
|
33
|
+
json (1.7.6)
|
34
34
|
mediashelf-loggable (0.4.9)
|
35
|
-
multi_json (1.
|
36
|
-
nokogiri (1.5.
|
35
|
+
multi_json (1.5.0)
|
36
|
+
nokogiri (1.5.6)
|
37
37
|
om (1.8.0)
|
38
38
|
activemodel
|
39
39
|
activesupport
|
@@ -49,20 +49,21 @@ GEM
|
|
49
49
|
rspec-core (~> 2.12.0)
|
50
50
|
rspec-expectations (~> 2.12.0)
|
51
51
|
rspec-mocks (~> 2.12.0)
|
52
|
-
rspec-core (2.12.
|
53
|
-
rspec-expectations (2.12.
|
52
|
+
rspec-core (2.12.2)
|
53
|
+
rspec-expectations (2.12.1)
|
54
54
|
diff-lcs (~> 1.1.3)
|
55
|
-
rspec-mocks (2.12.
|
55
|
+
rspec-mocks (2.12.1)
|
56
56
|
sanitize (2.0.3)
|
57
57
|
nokogiri (>= 1.4.4, < 1.6)
|
58
|
-
solrizer (2.0.
|
58
|
+
solrizer (2.1.0.rc1)
|
59
|
+
activesupport
|
59
60
|
daemons
|
60
61
|
mediashelf-loggable (~> 0.4.7)
|
61
62
|
nokogiri
|
62
63
|
om (>= 1.5.0)
|
63
64
|
stomp
|
64
65
|
xml-simple
|
65
|
-
stomp (1.2.
|
66
|
+
stomp (1.2.8)
|
66
67
|
xml-simple (1.1.2)
|
67
68
|
yard (0.8.3)
|
68
69
|
|
data/README.md
CHANGED
@@ -50,11 +50,22 @@ You can also do this via the command line:
|
|
50
50
|
This code originated in a Blacklight application and some of its default solr fields
|
51
51
|
reflect a Blacklight-style solr implementation. For example, certain facet fields such as
|
52
52
|
subject_topic_facet and title_display will appear in your solr index by default. If you
|
53
|
-
are trying out the gem within a default Blacklight installation, you
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
are trying out the gem within a default Blacklight installation, you will need to make
|
54
|
+
the following changes to your schema.xml file:
|
55
|
+
|
56
|
+
<dynamicField name="*_id" type="string" indexed="true" stored="true" multiValued="false" />
|
57
|
+
<dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true" />
|
58
|
+
|
59
|
+
Fields ending in "_id" are used for identifying components within finding aids as well as
|
60
|
+
the finding aid itself, which may not always be the same as the default "id" field for
|
61
|
+
the solr document. "_s" fields are not multivalued by default in Blacklight, so you'll
|
62
|
+
need to edit the existing entry for this dyamic field to reflect the change.
|
63
|
+
|
64
|
+
Other than that, your solr configuration should require no futher modifications;
|
65
|
+
however, the only fields that will appear in your search results will be format
|
66
|
+
and title. In order to make this into working solution, you'll need to modify
|
67
|
+
both the definitions of documents and components within SolrEad and configure
|
68
|
+
Blacklight's own display and facet fields accordingly.
|
58
69
|
|
59
70
|
## Applications
|
60
71
|
|
@@ -160,6 +171,15 @@ your solrconfig.xml file, under the "search" request handler:
|
|
160
171
|
|
161
172
|
<lst name="appends"><str name="fq">-component_children_b:[TRUE TO *]</str></lst>
|
162
173
|
|
174
|
+
## Issues
|
175
|
+
|
176
|
+
### eadid format
|
177
|
+
|
178
|
+
solr_ead uses the <eadid> node to create unique ids for documents. Consequently, if you're using
|
179
|
+
a rails app, this id will be a part of the url. If your eadid has .xml or some other combination
|
180
|
+
of characters preceeded by a period, this will cause Rails to interpret these characters as a
|
181
|
+
format, which you don't want. You may need to edit your eadid nodes if this is the case.
|
182
|
+
|
163
183
|
## Contributing
|
164
184
|
|
165
185
|
If you have questions or have specific needs, let me know. If you have other ideas or
|
data/lib/solr_ead/component.rb
CHANGED
@@ -86,7 +86,7 @@ class SolrEad::Component
|
|
86
86
|
super(solr_doc)
|
87
87
|
solr_doc.merge!({"format" => "Archival Item"})
|
88
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 })
|
89
|
-
solr_doc.merge!({"ref_id" => self.ref.first})
|
89
|
+
solr_doc.merge!({"ref_id" => self.ref.first.strip})
|
90
90
|
end
|
91
91
|
|
92
92
|
end
|
data/lib/solr_ead/document.rb
CHANGED
@@ -52,6 +52,8 @@ class SolrEad::Document
|
|
52
52
|
t.arrangement_heading(:path=>"archdesc/arrangement/head", :index_as=>[:displayable])
|
53
53
|
t.bioghist(:path=>"archdesc/bioghist/p", :index_as=>[:searchable])
|
54
54
|
t.bioghist_heading(:path=>"archdesc/bioghist/head", :index_as=>[:displayable])
|
55
|
+
t.bibliography(:path=>"archdesc/bibliography/bibref", :index_as=>[:searchable])
|
56
|
+
t.bibliography_heading(:path=>"archdesc/bibliography/head", :index_as=>[:displayable])
|
55
57
|
t.custodhist(:path=>"archdesc/custodhist/p", :index_as=>[:searchable])
|
56
58
|
t.custodhist_heading(:path=>"archdesc/custodhist/head", :index_as=>[:displayable])
|
57
59
|
t.fileplan(:path=>"archdesc/fileplan/p", :index_as=>[:searchable])
|
@@ -75,8 +77,8 @@ class SolrEad::Document
|
|
75
77
|
|
76
78
|
def to_solr(solr_doc = Hash.new)
|
77
79
|
super(solr_doc)
|
78
|
-
solr_doc.merge!({"id" => self.eadid.first})
|
79
|
-
solr_doc.merge!({"ead_id" => self.eadid.first})
|
80
|
+
solr_doc.merge!({"id" => self.eadid.first.strip})
|
81
|
+
solr_doc.merge!({"ead_id" => self.eadid.first.strip})
|
80
82
|
solr_doc.merge!({"format" => "Archival Collection"})
|
81
83
|
solr_doc.merge!({"heading_display" => ("Guide to the " + self.title.first + " (" + self.title_num.first + ")")}) unless self.title_num.empty?
|
82
84
|
return solr_doc
|
data/lib/solr_ead/indexer.rb
CHANGED
@@ -41,6 +41,7 @@ class Indexer
|
|
41
41
|
# Creates a new instance of SolrEad::Indexer and connects to your solr server
|
42
42
|
# using the url supplied in your config/solr.yml file.
|
43
43
|
def initialize(opts={})
|
44
|
+
Solrizer.default_field_mapper = EadMapper.new
|
44
45
|
if defined?(Rails.root)
|
45
46
|
url = YAML.load_file(File.join(Rails.root,"config","solr.yml"))[Rails.env]['url']
|
46
47
|
elsif ENV['RAILS_ENV']
|
data/lib/solr_ead/version.rb
CHANGED
data/lib/solr_ead.rb
CHANGED
data/lib/tasks/solr_ead.rake
CHANGED
data/solr_ead.gemspec
CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = SolrEad::VERSION
|
17
17
|
|
18
18
|
# Dependencies
|
19
|
-
gem.add_dependency('om'
|
20
|
-
gem.add_dependency('solrizer', '~> 2.0.
|
19
|
+
gem.add_dependency('om')
|
20
|
+
gem.add_dependency('solrizer', '~> 2.1.0.rc1')
|
21
21
|
gem.add_dependency('rsolr')
|
22
22
|
gem.add_dependency('sanitize')
|
23
23
|
gem.add_development_dependency('yard')
|
data/spec/document_spec.rb
CHANGED
@@ -3,10 +3,13 @@ require "spec_helper"
|
|
3
3
|
describe SolrEad::Document do
|
4
4
|
|
5
5
|
before(:all) do
|
6
|
+
Solrizer.default_field_mapper = EadMapper.new
|
6
7
|
@ex1 = SolrEad::Document.from_xml(fixture "ARC-0005.xml")
|
7
8
|
@ex2 = SolrEad::Document.from_xml(fixture "pp002010.xml")
|
9
|
+
@ex3 = SolrEad::Document.from_xml(fixture "ARC-0161.xml")
|
8
10
|
@solr_ex1 = @ex1.to_solr
|
9
11
|
@solr_ex2 = @ex2.to_solr
|
12
|
+
@solr_ex3 = @ex3.to_solr
|
10
13
|
end
|
11
14
|
|
12
15
|
describe "#terminology" do
|
@@ -44,6 +47,10 @@ describe SolrEad::Document do
|
|
44
47
|
@ex2.to_xml.should match "<c01\s"\
|
45
48
|
end
|
46
49
|
|
50
|
+
it "should have a bibliography" do
|
51
|
+
@ex3.bibliography.first.should == "All Music Guide. Accessed February 4, 2013. http://www.allmusic.com/."
|
52
|
+
end
|
53
|
+
|
47
54
|
end
|
48
55
|
|
49
56
|
describe ".to_solr" do
|