solrizer 2.0.0.rc2 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,11 +21,8 @@ class Extractor
21
21
  # @param [String] field_value
22
22
  def self.insert_solr_field_value(solr_doc, field_name, field_value)
23
23
  formatted_value = self.format_node_value(field_value)
24
- if solr_doc.has_key?(field_name)
25
- solr_doc[field_name] << formatted_value
26
- else
27
- solr_doc.merge!( {field_name => [formatted_value]} )
28
- end
24
+ solr_doc[field_name] ||= []
25
+ solr_doc[field_name] << formatted_value
29
26
  return solr_doc
30
27
  end
31
28
 
@@ -1,3 +1,3 @@
1
1
  module Solrizer
2
- VERSION = "2.0.0.rc2"
2
+ VERSION = "2.0.0.rc3"
3
3
  end
@@ -19,5 +19,12 @@ describe Solrizer::Extractor do
19
19
  Solrizer::Extractor.format_node_value("raw string\n with whitespace").should == "raw string with whitespace"
20
20
  end
21
21
  end
22
+
23
+ describe "#insert_solr_field_value" do
24
+ it "should initialize a solr doc list if it is nil" do
25
+ solr_doc = {'title_t' => nil }
26
+ Solrizer::Extractor.insert_solr_field_value(solr_doc, 'title_t', 'Frank')
27
+ end
28
+ end
22
29
 
23
30
  end
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.rc2
4
+ version: 2.0.0.rc3
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-10-25 00:00:00.000000000 Z
12
+ date: 2012-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri