Skip to content

Instantly share code, notes, and snippets.

@bussyjd
Created November 15, 2012 09:28
Show Gist options
  • Save bussyjd/4077626 to your computer and use it in GitHub Desktop.
Save bussyjd/4077626 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'tire'
require 'yajl/json_gem'
require 'debugger'
#class Lastic
url = ''
content = ''
start = Time.now
def elasticpush(url,content)
puts content
#store :url => url, :content => content
end
Tire.index 'yahoo' do
delete
create
File.open('yahoo.txt', 'r').each_with_index do |line, i|
debugger if i == 64185
if line =~ /^http/
if content.length > 0
puts "Problem id >> " + i.to_s
elasticpush(line,content)
end
#puts line
content = ''
line = ''
else
content += line
end
#break if i == 1000
end
refresh
end
finish = Time.now
totaltime = finish - start
puts "Total time: #{totaltime}"
trap("INT") { supervisor.terminate; exit }
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment