garry’s posterous

Stay hungry. Stay foolish.
« Back to blog
July 06, 2008

Ultrasphinx plugin problems on Win32

If you're trying to develop Rails in Win32 and using UltraSphinx for full-text searching, drop this into ultrasphinx.rb, otherwise indexing won't work. You'll get an obscure error "FATAL: config file ''C:/rails/rails_apps/posterous/config/ultrasphinx/development.conf'' does not exist or is not readable" after running rake ultrasphinx:index.

Here's the code snippet to drop into line 157 of ultrasphinx.rake:

  if RUBY_PLATFORM =~ /(:?mswin|mingw)/
    cmd = "indexer --config #{Ultrasphinx::CONF_PATH}"
  else
    cmd = "indexer --config '#{Ultrasphinx::CONF_PATH}'"
  end

There's another one in there around line 53 to start the server too. Ruby double-quotes the configuration path on win32 which results in the Sphinx indexer throwing that error about the config file being unreadable. It's there, alright, it just gets confused by the extra quotes.

Basically as of Monday I won't be developing on Win32 anymore (thankfully, my Macbook Pro arrives). It always makes sense to stick closely with what works. I can't even imagine how much time I've spent debugging obscure Rails problems on the Win32 platform. My friend Mark and I had to develop on Solaris before, and we ran into all sorts of issues where Solaris is just slightly different from Linux, but different enough to have to spend hours trying to figure out what's happening.

Don't let this happen to you. Friends don't let friends drive drunk or develop Rails applications on Windows.



Comments (6)
July 06, 2008

Brad said...

I care.

And I've been working with Rails on Windows for 2 1/2 painful years. But the pain of Rails on Windows is a lot easier to bear then the pain of .Net on Windows or Java on anything.

But that's just me.

July 06, 2008

Brad said...

oh yah, and I was going to suggest SOLR for your search engine. It's pretty wicked and gives a lot of options for granularity (search all posterous, search all my subscriptions, search one blog, etc). I'll check out ultrasphinx though.

July 06, 2008

Garry Tan said...

Haha, awesome. Good to know I have a comrade in arms on the Rails front. Solr looked cool, and I've written Lucene engines before. Didn't particularly want to take another dependency on Tomcat though... we'll see, search API's tend to be relatively encapsulated so it'll be possible to switch if Ultrasphinx can't scale. Sphinx is supposed to be the nginx of search.

July 06, 2008

Garry Tan said...

Forgot to mention why it's the nginx of search. It's fast and it's Russian. heh.

July 07, 2008

Roy S said...

The pain of installing and configuring on Windows made me simply give up on Ruby on Rails completely.

I wasn't nearly as determined to get it working as you've been.

July 07, 2008

Garry Tan said...

InstantRails brings you 99% of the way there, actually. In gene, except for random "just for me the dumb Win32 user" type bugs that happen every so often.

Leave a comment...
 
To leave a comment on this posterous, please login.
Click here to login or sign up