Cookies setting

Thinking Sphinx on Windows

Setting up a search engine in your rails application is quite simple in theory. All you need is a few short lines of code and the right gem. The problem usually occurs when installing the engine itself, especially on windows, as usual. What follows is a short guide on how to make sphinx work with mysql on windows, with some tips and useful links. I used to develop my search on my linux vps because of it. Then I tried Sunspot and life was beautiful, until it screw everything up... I blame the evil Java and my self, for even consider. using it. Now I am back on Sphinx and I even make it work on windows. Here is how.


Here is a step by step tutorial on how you set up Sphinx on Windows independently (for us ewith other platforms like php). This video explains the process in even more detail (I advice to watch the whole video first). Important: when you copy paste the commands from the site to the windows command line -- will become - and nothing will work.This is not necessary  to make it work with Thinking Sphinx, but I think is good to know how sphinx works.

All you need to make Thinking Sphinx work is download the appropriate version (64bit if u have 64bit mysql), put the folder somewhere on your pc (like c:\sphinx) and change your projects config\sphinx.yml to match your \sphinx\bin\ location. If sphinx.yml doesn’t exist create one and put in something like this:

 bin_path: c:\sphinx\bin\
 port: 9312
 searchd_binary_name: searchd
 indexer_binary_name: indexe

If you get this error: Error in my_thread_global_end(): 1 threads didn't exit
All oyu need to do is copy libmySQL.dll from your ruby\bin to your sphinx\bin.

This error may ocure also: index 'post_core': column number 1 has no name
It means you haven't used the appropriate version of sphinx for your mysql (64 bit for 64 bit mysql...).

Now if you followed the Thinking Sphinx documentation or the still valid RailsCast  (there is aso an updated paid version, that in my opinion is not necesary. The official  documentation is more than enough to make itl work as you want.).


I hope this will be helpfull to somene in the same position as I was.

06 Nov 2012 at 17:49