Using Ruby to POST to Solr

2007-09-11 Thread Matt Mitchell
Hi, I just posted this to the ruby/google group. It probably belongs here! Also, anyone know exactly what the @ symbol in the curl command is doing? Thanks, Matt I've got a script that uses curl, and would like (for educational purposes mind you) to use ruby instead. This is the curl

Re: Using Ruby to POST to Solr

2007-09-11 Thread Michael Kimsal
The curl man page states: If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. The contents of the file must already be url-encoded. Multiple files can also be specified.

Re: Using Ruby to POST to Solr

2007-09-11 Thread Matt Mitchell
Hi Michael, Thanks for that. I've got something that's working now: data = File.read('my_solr_docs.xml') url = URI.parse('http://localhost:8080/my_solr/update') http = Net::HTTP.new(url.host, url.port) response, body = http.post(url.path, data, {'Content-type'='text/ xml; charset=utf-8'})

Re: Using Ruby to POST to Solr

2007-09-11 Thread Erik Hatcher
Matt, Try this instead: gem install solr-ruby # ;) Then in irb or wherever: solr = Solr::Connection.new(http://localhost:8983/solr;) solr.add(:id = 123, :title = insert title here) solr.commit solr.query(title) Visit us over on the [EMAIL PROTECTED] e-mail list for more on

Re: Using Ruby to POST to Solr

2007-09-11 Thread Matt Mitchell
Yes! Beautiful. I'll be checking that out. matt On Sep 11, 2007, at 12:18 PM, Erik Hatcher wrote: Matt, Try this instead: gem install solr-ruby # ;) Then in irb or wherever: solr = Solr::Connection.new(http://localhost:8983/solr;) solr.add(:id = 123, :title = insert title here)