RSolr::Direct with Sunspot(::Rails)

22 views
Skip to first unread message

Gert Thiel

unread,
Sep 9, 2010, 1:16:01 AM9/9/10
to rsolr
Hello.

I'm moving from MRV w/ Passenger to JRuby w/ Glassfish 3 using the
Glassfish gem.

As Solr is no critical component, I want to run Solr embedded in the
Glassfish instance.
I got Delayed::Job's worker to run in a thread ;-)

I consider to use RSolr::Direct instead of the Sunspot-includedbut
external Solr to avoid HTTP roundtrips.
Does anyone have a recipe how to combine Sunspot::Rails (or bare
Sunspot at least) with RSolr::Direct?

Thanks in advance.

Gert Thiel

matt mitchell

unread,
Sep 9, 2010, 1:04:20 PM9/9/10
to rsolr
Hi Gert,

You should be able to set Sunspot's connection instance to a direct
connection. I don't think Sunspot's API allows public access to this
sort of thing, but using Ruby's #send or #instance_variable_set you
can get around that? The direct connection should work as a drop-in
replacement if you get that working though. Have a look at Sunspot's
session class I think.

Matt

Gert Thiel

unread,
Sep 12, 2010, 9:41:22 AM9/12/10
to rsolr
Hi Matt.

Thanks for your hint.

I have created a Gist with my current solution: http://gist.github.com/576114

My test suite passes green but I did not try that on my production
system yet.

Gert.
Reply all
Reply to author
Forward
0 new messages