Skip to content

Apache Lucene open-source search software

Add yield to indexer, allowing client to have final control over the Solr document indexed after the mapping has been made

Erik Hatcherff396cac7979
diff --git a/client/ruby/solr-ruby/lib/solr/indexer.rb b/client/ruby/solr-ruby/lib/solr/indexer.rb
index a015a3859da..e6af3baa98c 100755
--- a/client/ruby/solr-ruby/lib/solr/indexer.rb
+++ b/client/ruby/solr-ruby/lib/solr/indexer.rb
@@ -18,8 +18,7 @@ class Solr::Indexer
data_source.each do |record|
document = mapper.map(record)
- # yield(document) if block_given? # TODO: does yielding add value here? possibly to allow the caller
- # to manipulate the document outside of mappings just before indexing?
+ yield(record, document) if block_given?
solr.add(document) unless options[:debug]
puts document.inspect if options[:debug]