Acts_as_solr: Starting solr server on windows

By bansalakhil September 13, 2007

I was using acts_as_searchable for one of my project, which uses Hyperestraier in background. Yesterday I decided to use acts_as_solr which uses solr(based on Lucene Java search library). I did all written in its Manual/Readme, but when I issued

to start the solr server, it threw a heart breaking “Bad file descriptor” error, although acts_as_solr was working fine on one of my colleague’s linux machine.

I started digging around this and found that there is an issue in rake task that starts the solr server. Actually the problem was this rake task uses ‘fork’ which is not available on windows, also it only handles ‘ECONNREFUSED’ exception which is actually “Connection Refused” error raised by ruby on linux. But in windown it throws ‘EBADF’ which is “Bad file descriptor” error raised by ruby on windows.

So below is the hack for that:

Just add this to vendor/plugins/acts_as_solr/lib/taks/solr.rake, and start solr server on windows by issuing

Share this:

Leave a comment

Your email address will not be published. Required fields are marked *

3 comments

  1. Ajay Kumar says:

    Hi,

    try cygwin and get rid of all the annoying windows issues.

    thanks,
    Ajay

  2. akhil says:

    Its always better to use Mac/Linux for development.
    Use windows just for entertainment

  3. Chris rittersdrf says:

    Wow akhil. That’s not helpful at all. Unfortunately in the real world sometimes you have to make things work in Windows.

    I’m curious. As someone who’s used to linux is there a way to get this task to run without having to have the shell open the entire duration of it’s operation. Is there a way to background this process? It’s been a while since I’ve worked with Windows.