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/02/06 11:30:07 UTC

svn commit: r504065 - /lucene/solr/trunk/client/ruby/solrb/examples/marc/marc_importer.rb

Author: ehatcher
Date: Tue Feb  6 02:30:06 2007
New Revision: 504065

URL: http://svn.apache.org/viewvc?view=rev&rev=504065
Log:
Add gunzip capability to MARC importer

Modified:
    lucene/solr/trunk/client/ruby/solrb/examples/marc/marc_importer.rb

Modified: lucene/solr/trunk/client/ruby/solrb/examples/marc/marc_importer.rb
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/client/ruby/solrb/examples/marc/marc_importer.rb?view=diff&rev=504065&r1=504064&r2=504065
==============================================================================
--- lucene/solr/trunk/client/ruby/solrb/examples/marc/marc_importer.rb (original)
+++ lucene/solr/trunk/client/ruby/solrb/examples/marc/marc_importer.rb Tue Feb  6 02:30:06 2007
@@ -1,3 +1,4 @@
+#!/usr/bin/env ruby
 # The ASF licenses this file to You under the Apache License, Version 2.0
 # (the "License"); you may not use this file except in compliance with
 # the License.  You may obtain a copy of the License at
@@ -37,6 +38,13 @@
 
 connection = Solr::Connection.new(solr_url)
 
+if marc_filename =~ /.gz$/
+  puts "Unzipping data file..."
+  system("cp #{marc_filename} /tmp/marc_data.mrc.gz")
+  system("gunzip /tmp/marc_data.mrc.gz")
+  marc_filename = "/tmp/marc_data.mrc"
+end
+
 reader = MARC::Reader.new(marc_filename)
 count = 0
 
@@ -61,6 +69,7 @@
   extracted_data.compact.uniq
 end
 
+puts "Indexing..."
 for record in reader
   doc = {}
   mapping.each do |key,value|
@@ -87,3 +96,4 @@
 end
 
 connection.send(Solr::Request::Commit.new) unless debug
+puts "Done"