cleanup word count importer

This commit is contained in:
Chris Anderson 2008-06-02 09:37:47 -07:00
parent e4e533e533
commit 01291501a6

View file

@ -13,7 +13,6 @@ db = couch.create_db('word-count-example')
lines = [] lines = []
chunk = 0 chunk = 0
while line = file.gets while line = file.gets
puts chunk
lines << line lines << line
if lines.length > 10 if lines.length > 10
db.save({ db.save({
@ -22,6 +21,7 @@ db = couch.create_db('word-count-example')
:text => lines.join('') :text => lines.join('')
}) })
chunk += 1 chunk += 1
puts chunk
lines = [] lines = []
end end
end end
@ -50,6 +50,6 @@ end
# } # }
# }) # })
puts "The books have been stored in your CouchDB. To initiate the MapReduce process, visit http://localhost:5984/_utils/ in your browser and click 'word-count-example', then select view 'words' or 'count'. The process could take about 15 minutes on an average MacBook." # puts "The books have been stored in your CouchDB. To initiate the MapReduce process, visit http://localhost:5984/_utils/ in your browser and click 'word-count-example', then select view 'words' or 'count'. The process could take about 15 minutes on an average MacBook."
#