Faraday as RSolr backend?

79 views
Skip to first unread message

matt mitchell

unread,
Jul 12, 2011, 6:04:14 PM7/12/11
to rs...@googlegroups.com
I've been watching Faraday for some time and I'm thinking it'd make a great back-end for RSolr. Instead of me/others having to manage a driver (which I'm doing a terrible job at) for curl/curb, event machine, net::http etc. this thing would replace all of that.

Any strong feelings on this? The only real side effect would be a new dependency, but I think it'd be worth it.

Matt

p.s. here's a great article:

http://mislav.uniqpath.com/2011/07/faraday-advanced-http/

matt mitchell

unread,
Apr 22, 2012, 5:28:33 PM4/22/12
to rs...@googlegroups.com
Curious if anyone has played with Faraday? It's looking pretty awesome. The big win would be the possibility to use whatever http client adapter you like best. There are drivers for Typhoeus, Patron, Event Machine, Patron etc.. So yeah, it does async.

I'd imagine the interface to RSolr would remain the same, except a block could be used to customize the Faraday connection, and each request:

rsolr = RSolr.connect do |con|
  conn.adapter = :typhoeus
end

res = rsolr.request("select") do |req|
  # req is the Faraday request builder:
  req.params = {:q => "blah"}
end

It also looks like it supports streaming POSTs so, the streaming update handler in Solr could be used.

This would add one more dependency to RSolr, unless you decided to use an http client other than Ruby's Net::Http.

Check it out:

https://github.com/technoweenie/faraday

Matthew A. Brown

unread,
Apr 22, 2012, 5:48:23 PM4/22/12
to rs...@googlegroups.com
Faraday is popular and definitely has some advantages, most notably
the built-in adapter support for different client libraries. In my
experience, the implementation is a bit weird in places, which can
lead to trouble when trying to step outside of common use cases for
the library. The adapters can also be a bit shoddy (e.g., the Typhoeus
adapter doesn't raise an error for an ECONNREFUSED).

But on balance, it's a win.

> --
> You received this message because you are subscribed to the Google Groups
> "rsolr" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rsolr/-/oUbDvK783FkJ.
> To post to this group, send email to rs...@googlegroups.com.
> To unsubscribe from this group, send email to
> rsolr+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rsolr?hl=en.

Reply all
Reply to author
Forward
0 new messages