Skip to content

Instantly share code, notes, and snippets.

@ananthakumaran
Created June 11, 2012 07:54
Show Gist options
  • Save ananthakumaran/2908980 to your computer and use it in GitHub Desktop.
Save ananthakumaran/2908980 to your computer and use it in GitHub Desktop.
server = Sunspot::Rails::Server.new
begin
server.start
rescue Sunspot::Server::AlreadyRunningError
Sunspot.remove_all
end
# wait until the solr server is ready
loop {
sleep 1
begin
Sunspot.remove_all
break
rescue
# "solr not ready"
end
}
at_exit do
Sunspot.remove_all
server.stop
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment