You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by eh...@apache.org on 2007/05/19 22:48:26 UTC
svn commit: r539800 -
/lucene/solr/trunk/client/ruby/solr-ruby/lib/solr/indexer.rb
Author: ehatcher
Date: Sat May 19 13:48:26 2007
New Revision: 539800
URL: http://svn.apache.org/viewvc?view=rev&rev=539800
Log:
provide the Solr connection to clients of the indexer
Modified:
lucene/solr/trunk/client/ruby/solr-ruby/lib/solr/indexer.rb
Modified: lucene/solr/trunk/client/ruby/solr-ruby/lib/solr/indexer.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/solr-ruby/lib/solr/indexer.rb?view=diff&rev=539800&r1=539799&r2=539800
==============================================================================
--- lucene/solr/trunk/client/ruby/solr-ruby/lib/solr/indexer.rb (original)
+++ lucene/solr/trunk/client/ruby/solr-ruby/lib/solr/indexer.rb Sat May 19 13:48:26 2007
@@ -11,12 +11,9 @@
# limitations under the License.
class Solr::Indexer
- # deprecated, use Indexer.new(ds,mapping).index instead
- def self.index(data_source, mapper_or_mapping, options={})
- indexer = Solr::Indexer.new(data_source, mapper_or_mapping, options)
- indexer.index
- end
+ attr_reader :solr
+ # TODO: document options!
def initialize(data_source, mapper_or_mapping, options={})
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
@@ -33,7 +30,8 @@
@data_source.each do |record|
document = @mapper.map(record)
- yield(record, document) if block_given? # TODO check return of block, if not true then don't index
+ # TODO: check arrity of block, if 3, pass counter as 3rd argument
+ yield(record, document) if block_given? # TODO check return of block, if not true then don't index, or perhaps if document.empty?
buffer << document