As you may know mysql fulltext search is not highly scalable.Â One of the options to get around this scalability limitation, which I prefer, is to use Sphinx.Â You can use Sphinx with out having to alter your mysql installation.Â But, if you would like to use from within mysql and not have to worry about how to pass data between Sphinx and MySQL, you can enable sphinxse (sphinx storage engine).Â It is not included with mysql by default so you will have to compile it yourself.
Here are the instructions on how to get sphinxse compiled with your mysql installation on CentOS x64.Â I am sure same instructions will work for other flavors but I have not tested it.Â I will be compiling the most current version of sphinx (0.9.8) with most current stable version of mysql (5.0.51b) at the time of the writing.Â Let’s get the appropriate packages first:
tar zxpf sphinx*
tar zxpf mysql*
You will also need “bison”, “patch”, “automake” and “libtool” installed.Â Let us just do a yum install for it.
yum -y install bison patch automake libtool
NOTE:Â if you don’t install bison, you will get the following error:
sed '/^#/ s|y\.tab\.c|sql_yacc.cc|' y.tab.c >sql_yacc.cct && mv sql_yacc.cct sql_yacc.cc
sed: can't read y.tab.c: No such file or directory
make: *** [sql_yacc.cc] Error 2
Let us continue with patching mysql source with sphinx storage engine (sphinxse) code and compile/install our new binaries.
patch -p1 < ../sphinx-0.9.8/mysqlse/sphinx.5.0.37.diff #Make sure everything succeeded.
cp ../sphinx-0.9.8/mysqlse/* sql/sphinx
./configure --prefix=/usr/local/mysql --with-sphinx-storage-engine
Now start your mysql installtion and check if engine support is compiled in:
mysql> show engines\G
Comment: Sphinx storage engine 0.9.8
To read more about how to use Sphinx storage engine, please refer to:Â Sphinx documentation for using sphinx storage engine
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.