Apache Solr open-source search software
Allow field hash to take an array for values
Erik Hatcher5e4dcfa8895d
diff --git a/client/ruby/solrb/lib/solr/document.rb b/client/ruby/solrb/lib/solr/document.rbindex ad2e9102e59..e29450e02ca 100644--- a/client/ruby/solrb/lib/solr/document.rb+++ b/client/ruby/solrb/lib/solr/document.rb@@ -36,7 +36,9 @@ module Solrdef <<(fields)case fieldswhen Hash- fields.each_pair {|k,v| @fields << Solr::Field.new(k => v)}+ fields.each_pair do |name,value|+ value.each {|v| @fields << Solr::Field.new(name => v)}+ endwhen Solr::Field@fields << fieldselsediff --git a/client/ruby/solrb/test/unit/document_test.rb b/client/ruby/solrb/test/unit/document_test.rbindex c0cbf881a7b..bf165667d3e 100644--- a/client/ruby/solrb/test/unit/document_test.rb+++ b/client/ruby/solrb/test/unit/document_test.rb@@ -31,6 +31,11 @@ class DocumentTest < Test::Unit::TestCaseassert_equal "<doc><field name='creator'>Erik Hatcher</field><field name='creator'>Otis Gospodnetic</field></doc>", doc.to_xml.to_send+ def test_repeatable_in_hash+ doc = Solr::Document.new({:creator => ['Erik Hatcher', 'Otis Gospodnetic']})+ assert_equal "<doc><field name='creator'>Erik Hatcher</field><field name='creator'>Otis Gospodnetic</field></doc>", doc.to_xml.to_s+ end+def test_bad_docdoc = Solr::Document.newassert_raise(RuntimeError) do