solrizer 2.0.0.rc3 → 2.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -8
- data/History.txt +7 -0
- data/Rakefile +0 -10
- data/lib/solrizer/version.rb +1 -1
- data/lib/solrizer/xml/terminology_based_solrizer.rb +4 -4
- data/solrizer.gemspec +1 -3
- data/spec/fixtures/mods_article.rb +4 -2
- data/spec/fixtures/mods_articles/hydrangea_article1.xml +2 -2
- data/spec/spec_helper.rb +0 -1
- data/spec/units/xml_terminology_based_solrizer_spec.rb +16 -2
- metadata +2 -34
data/Gemfile
CHANGED
@@ -2,11 +2,8 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
gem '
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
gem 'simplecov', :platform => :mri_19
|
11
|
-
gem 'simplecov-rcov', :platform => :mri_19
|
12
|
-
|
5
|
+
group :development, :test do
|
6
|
+
gem 'rcov', :platform => :mri_18
|
7
|
+
gem 'simplecov', :platform => :mri_19
|
8
|
+
gem 'simplecov-rcov', :platform => :mri_19
|
9
|
+
end
|
data/History.txt
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
h2. 2.0.0
|
2
2
|
HYDRA-827 DO NOT index terms by default
|
3
|
+
HYDRA-863 Null pointer exception fixed.
|
4
|
+
|
5
|
+
BUG: Replaced data_type method with type which was causing the :type option in OM terms not to work. This makes certain tests
|
6
|
+
not pass under Ruby 1.8.7, specifically when using :type option with a proxied term in OM.
|
7
|
+
|
8
|
+
Test fixes such as properly testing solr field suffixes when using the :type option in OM as well as using correct
|
9
|
+
ISO.8601 dates in our fixtures
|
3
10
|
|
4
11
|
h2. 1.2.2
|
5
12
|
BUG: RSolr::Client doesn't have a delete method. Changed to delete_by_id. (only affects solrizer shell script) Thanks to mkorcy.
|
data/Rakefile
CHANGED
@@ -11,13 +11,3 @@ task :spec => ['solrizer:rspec']
|
|
11
11
|
task :rcov => ['solrizer:rcov']
|
12
12
|
|
13
13
|
task :default => :spec
|
14
|
-
|
15
|
-
require 'rdoc/task'
|
16
|
-
Rake::RDocTask.new do |rdoc|
|
17
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
18
|
-
|
19
|
-
rdoc.rdoc_dir = 'rdoc'
|
20
|
-
rdoc.title = "solrizer #{version}"
|
21
|
-
rdoc.rdoc_files.include('README*')
|
22
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
-
end
|
data/lib/solrizer/version.rb
CHANGED
@@ -36,7 +36,7 @@ module Solrizer::XML::TerminologyBasedSolrizer
|
|
36
36
|
nodeset.each do |node|
|
37
37
|
# create solr fields
|
38
38
|
|
39
|
-
|
39
|
+
doc.solrize_node(node, term_pointer, term, solr_doc, field_mapper)
|
40
40
|
unless term.kind_of? OM::XML::NamedTermProxy
|
41
41
|
term.children.each_pair do |child_term_name, child_term|
|
42
42
|
doc.solrize_term(child_term, solr_doc, field_mapper, opts={:parents=>parents+[{term.name=>nodeset.index(node)}]})
|
@@ -68,7 +68,7 @@ module Solrizer::XML::TerminologyBasedSolrizer
|
|
68
68
|
|
69
69
|
generic_field_name_base = OM::XML::Terminology.term_generic_name(*term_pointer)
|
70
70
|
|
71
|
-
field_mapper.solr_names_and_values(generic_field_name_base, node_value, term.
|
71
|
+
field_mapper.solr_names_and_values(generic_field_name_base, node_value, term.type, term.index_as).each do |field_name, field_value|
|
72
72
|
unless field_value.join("").strip.empty?
|
73
73
|
::Solrizer::Extractor.insert_solr_field_value(solr_doc, field_name, field_value)
|
74
74
|
end
|
@@ -76,7 +76,7 @@ module Solrizer::XML::TerminologyBasedSolrizer
|
|
76
76
|
|
77
77
|
if term_pointer.length > 1
|
78
78
|
hierarchical_field_name_base = OM::XML::Terminology.term_hierarchical_name(*term_pointer)
|
79
|
-
field_mapper.solr_names_and_values(hierarchical_field_name_base, node_value, term.
|
79
|
+
field_mapper.solr_names_and_values(hierarchical_field_name_base, node_value, term.type, term.index_as).each do |field_name, field_value|
|
80
80
|
unless field_value.join("").strip.empty?
|
81
81
|
::Solrizer::Extractor.insert_solr_field_value(solr_doc, field_name, field_value)
|
82
82
|
end
|
@@ -98,7 +98,7 @@ module Solrizer::XML::TerminologyBasedSolrizer
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def solrize_node(node, term_pointer, term, solr_doc = Hash.new, field_mapper = self.field_mapper, opts={})
|
101
|
-
Solrizer::XML::TerminologyBasedSolrizer.solrize_node(node, self, term_pointer, solr_doc, field_mapper, opts)
|
101
|
+
Solrizer::XML::TerminologyBasedSolrizer.solrize_node(node, self, term_pointer, term, solr_doc, field_mapper, opts)
|
102
102
|
end
|
103
103
|
|
104
104
|
end
|
data/solrizer.gemspec
CHANGED
@@ -20,10 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency "daemons"
|
21
21
|
s.add_development_dependency 'rspec', '~>2.0'
|
22
22
|
s.add_development_dependency 'rake'
|
23
|
-
s.add_development_dependency 'rdoc'
|
24
|
-
s.add_development_dependency 'mocha'
|
25
23
|
s.add_development_dependency 'yard'
|
26
|
-
s.add_development_dependency 'RedCloth'
|
24
|
+
s.add_development_dependency 'RedCloth' # yard depends on redcloth
|
27
25
|
|
28
26
|
s.files = `git ls-files`.split("\n")
|
29
27
|
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
@@ -54,7 +54,7 @@ module Samples
|
|
54
54
|
t.title_info(:index_as=>[:facetable],:ref=>[:title_info])
|
55
55
|
t.origin_info(:path=>"originInfo") {
|
56
56
|
t.publisher
|
57
|
-
t.date_issued(:path=>"dateIssued")
|
57
|
+
t.date_issued(:path=>"dateIssued", :type => :date, :index_as => [:searchable])
|
58
58
|
t.issuance(:index_as=>[:facetable])
|
59
59
|
}
|
60
60
|
t.issn(:path=>"identifier", :attributes=>{:type=>"issn"})
|
@@ -68,7 +68,7 @@ module Samples
|
|
68
68
|
}
|
69
69
|
t.start_page(:proxy=>[:pages, :start])
|
70
70
|
t.end_page(:proxy=>[:pages, :end])
|
71
|
-
t.publication_date(:path=>"date", :index_as=>[:searchable])
|
71
|
+
t.publication_date(:path=>"date", :type => :date, :index_as => [:searchable])
|
72
72
|
}
|
73
73
|
}
|
74
74
|
t.note
|
@@ -78,6 +78,8 @@ module Samples
|
|
78
78
|
t.publication_url(:proxy=>[:location,:url])
|
79
79
|
t.title(:proxy=>[:title_info, :main_title])
|
80
80
|
t.journal_title(:proxy=>[:journal, :title_info, :main_title])
|
81
|
+
t.pub_date(:proxy=>[:journal, :issue, :publication_date])
|
82
|
+
t.issue_date(:ref=>[:journal, :origin_info, :date_issued])
|
81
83
|
end
|
82
84
|
|
83
85
|
# Changes from OM::Properties implementation
|
@@ -61,7 +61,7 @@
|
|
61
61
|
</titleInfo>
|
62
62
|
<originInfo>
|
63
63
|
<publisher>PUBLISHER</publisher>
|
64
|
-
<dateIssued>
|
64
|
+
<dateIssued>2007-02-15</dateIssued>
|
65
65
|
</originInfo>
|
66
66
|
<identifier type="issn">0013-8908</identifier>
|
67
67
|
<part>
|
@@ -75,7 +75,7 @@
|
|
75
75
|
<start>195</start>
|
76
76
|
<end>230</end>
|
77
77
|
</extent>
|
78
|
-
<date>
|
78
|
+
<date>2007-02-01</date>
|
79
79
|
</part>
|
80
80
|
</relatedItem>
|
81
81
|
|
data/spec/spec_helper.rb
CHANGED
@@ -35,7 +35,7 @@ describe Solrizer::XML::TerminologyBasedSolrizer do
|
|
35
35
|
solr_doc = Hash.new
|
36
36
|
@mods_article.field_mapper = Solrizer::FieldMapper::Default.new
|
37
37
|
Samples::ModsArticle.terminology.terms.each_pair do |k,v|
|
38
|
-
@mods_article.
|
38
|
+
@mods_article.should_receive(:solrize_term).with(v, solr_doc, @mods_article.field_mapper)
|
39
39
|
end
|
40
40
|
@mods_article.to_solr(solr_doc)
|
41
41
|
end
|
@@ -55,7 +55,7 @@ describe Solrizer::XML::TerminologyBasedSolrizer do
|
|
55
55
|
solr_doc["topic_tag_t"].sort.should == ["CONTROLLED TERM", "TOPIC 1", "TOPIC 2"]
|
56
56
|
|
57
57
|
# These are a holdover from an old verison of OM
|
58
|
-
solr_doc['
|
58
|
+
solr_doc['journal_0_issue_0_publication_date_dt'].should == ["2007-02-01"]
|
59
59
|
|
60
60
|
|
61
61
|
end
|
@@ -85,6 +85,20 @@ describe Solrizer::XML::TerminologyBasedSolrizer do
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
it "should add fields based on type using proxy" do
|
89
|
+
unless RUBY_VERSION.match("1.8.7")
|
90
|
+
solr_doc = Hash.new
|
91
|
+
result = @mods_article.solrize_term(Samples::ModsArticle.terminology.retrieve_term(:pub_date), solr_doc)
|
92
|
+
solr_doc["pub_date_dt"].should == ["2007-02-01"]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should add fields based on type using ref" do
|
97
|
+
solr_doc = Hash.new
|
98
|
+
result = @mods_article.solrize_term(Samples::ModsArticle.terminology.retrieve_term(:issue_date), solr_doc)
|
99
|
+
solr_doc["issue_date_dt"].should == ["2007-02-15"]
|
100
|
+
end
|
101
|
+
|
88
102
|
it "shouldn't index terms where index_as is an empty array" do
|
89
103
|
fake_solr_doc = {}
|
90
104
|
term = Samples::ModsArticle.terminology.retrieve_term(:name)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solrizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc4
|
5
5
|
prerelease: 6
|
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
|
+
date: 2012-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -139,38 +139,6 @@ dependencies:
|
|
139
139
|
- - ! '>='
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: rdoc
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '0'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: mocha
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
142
|
- !ruby/object:Gem::Dependency
|
175
143
|
name: yard
|
176
144
|
requirement: !ruby/object:Gem::Requirement
|