It has been a few weeks after my first encounter with this Egyptian named gem called Sphinx. At first glance, it’s complicated when looking at an already made sphinx.conf. However, after careful redesigning and re-tinkering, it turns out to be one of the most flexible and yet light fulltext search engine available today. There are others but nothing as light, fast and sleek as Sphinx. The cold truth is that Sphinx is supporting SQL based databases as far as I know. Since Urbanesia is already using MySQL as our backend, we’re lucky.
The first and most difficult part of learning Sphinx is it’s installation routine. Numerous times I have failed compiling Sphinx on my Macbook and also on CentOS servers. That made me stayed away too far from it. So after a few Googling sessions, I thought it was time to tame the beast. First step was to compile Sphinx on my Macbook.
What you’re gonna need are:
- Sphinx source code provided here. I downloaded the latest 1.10 Beta version, spoilers: Realtime Indexes :)
- expat library provided here.
- libiconv library provided here.
sudo -s
cd /opt/sources
tar xfz expat-2.0.1.tar.gz
cd expat-2.0.1
./configure –prefix=/usr/local
make && make install
cd ..
tar xfz libiconv-1.12.tar.gz
cd libiconv-1.12
./configure –prefix=/usr/local
make && make install
cd ..
tar xfz sphinx-1.10-beta.tar.gz
cd sphinx-1.10-beta
./configure ‘–prefix=/usr/local/sphinx’ CPPFLAGS=“-I/usr/local/include -I/opt/local/include -I/Applications/xampp/xamppfiles/include -I/Applications/xampp/xamppfiles/include -arch i386” LDFLAGS=“-L/usr/local/lib -L/opt/local/lib” ‘CFLAGS=-O -arch i386’ ‘LDFLAGS=-arch i386’ ‘CXXFLAGS=-O -arch i386’
make -j4 install
The next part of the tutorial will be about generating your own sphinx.conf. Until then!