Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Allow a Hash to be an available mapper parameter, instead of the client having to create a Mapper instance itself

Erik Hatcherd1f038a1c8fb
diff --git a/client/ruby/solr-ruby/lib/solr/indexer.rb b/client/ruby/solr-ruby/lib/solr/indexer.rb
index 9089b373b9d..4b8b5661b6c 100755
--- a/client/ruby/solr-ruby/lib/solr/indexer.rb
+++ b/client/ruby/solr-ruby/lib/solr/indexer.rb
@@ -11,7 +11,8 @@
# limitations under the License.
class Solr::Indexer
- def self.index(data_source, mapper, options={})
+ def self.index(data_source, mapper_or_mapping, options={})
+ mapper = mapper_or_mapping.is_a?(Hash) ? Solr::Importer::Mapper.new(mapper_or_mapping) : mapper_or_mapping
solr_url = options[:solr_url] || ENV["SOLR_URL"] || "http://localhost:8983/solr"
solr = Solr::Connection.new(solr_url, options) #TODO - these options contain the solr_url and debug keys also, so tidy up what gets passed