So far, I’ve introduced Sphinx search and told you how to install Sphinx search. The next step would be to get it running. This is almost as simple as installing it, but a little bit more work. This is only a very basic configuration setup. I might at a later stage introduce you to some of the more complex settings.
To get it up and running, there are three components that you need to be aware of.
- The sphinx.conf configuration file which is the heart and soul of Sphinx search
- The indexer command which will compile the index that you will be querying
- The searchd command which will start the search daemon (or service) on your server
Note that by default on a Debian server, the indexer and searchd commands can be found in /usr/local/bin/ and the sphinx.conf file can be found in /usr/local/etc/
1. Editing the sphinx.conf file
You can either create a sphinx.conf file locally and then secure copy it to the /usr/local/etc/ directory on your server, or you can simply use your favorite command line editor (which should be vim :) ) on your server. There is a sample config file which you could copy and then edit, should you want to. Do it like such:
cd /usr/local/etc cp sphinx.conf.in sphinx.conf
In the config file, there are 4 main configuration components:
- The source of the index. I.e. what it should index. Plainly put, which database, the query, the query settings, etc.
- The index settings. How should Sphinx use the source you’ve set up.
- The indexer settings. How should Sphinx index your previously set up indexes
- The searchd settings. How should Sphinx listen for queries from your application
Note that the source section of the index can be inherited, so you don’t have to repeat settings all the time. Also note that you may well want more than one index to query (lets say you want an index for blog posts and for bookmarks) so for every index you need, you’ll create a source and index. This is then in VERY basic terms what your structure of the config file should look like:
#The settings and SQL source for your index
source blogposts
{
#SQL and settings goes here
}
#The index for the source
index blogpostsindex
{
#the source of this index
#and its settings goes here
source = blogposts
}
indexer
{
#settings for the indexer command
}
searchd
{
#settings for the sphinx daemon goes here
}
Lets move on to a practical example. Setting up Sphinx Search Part 2
Welcome back! You should subscribe to my RSS feed here.
You should follow me on Twitter here
You should follow me on Gatorpeeps here.







Afrigator gets a facelift | Afrigator Blog 9:57 am on November 28, 2008 Permalink |
[...] but not the fastest in the world. Sort of like an old 1600 Corolla. Stii’s new and improved Sphinx Search cuts the average search time from 4s to roughly 0.01s. So now you can find what you want a lot [...]
Afrigator Makes More Improvements « TechMASAI 11:47 am on November 28, 2008 Permalink |
[...] An updated search algorithm, which will cut down on search times. It is based on something called Sphinx Search [...]
Naveen Singh 6:38 pm on February 21, 2009 Permalink |
Hi , Will u help me in sphinix , i want to use in one my site.
Thanks
Ezhil 11:08 am on December 14, 2009 Permalink |
Instead of depending on a plugin you can directly configure sphnix search to your search engine. i have already done it and its pretty simple see this post http://flexlearner.wordpress.com/2009/12/03/sphinx-search/