Support/Sphinx Installation
Installing Sphinx Search
The differences between installing Sphinx on a local machine or SUMO's production .
- Download the source from http://sphinxsearch.com/downloads.html. SUMO is using 0.9.9-release.
- Read the installation instructions, focusing on steps 2.1 through 2.3 (or 2.4 if installing on Windows). Make sure your system meets the requirements in steps 2.1 and 2.2.
- Follow the instructions in 2.3 to build and install Sphinx
- (optional): Set the --prefix option to /usr/local/sphinx. The binaries should end up in /usr/local/sphinx/bin, and the /usr/local/sphinx/etc should contain the configuration files. This step is optional--just insure you adjust file paths in the remainder of the directions and modify the configuration files accordingly (sphinx.conf in step 6 and search.conf.php in step 12) if you don't install using this prefix.
- Make sure that the folder /usr/local/sphinx/bin is in the search path.
- Create the directory /usr/local/sphinx/index/. This folder and files in it must be writable/readable by the apache web server user, and be on a reasonably large volume (space considerations).
- Replace /usr/local/sphinx/etc/sphinx.conf with the sphinx.conf from bug 463708. If /usr/local/sphinx/index/ is located in a different directory than the one used here, you'll need to update sphinx.conf.
- Apply the patch in bug 494327 to /usr/local/sphinx/etc/sphinx.conf. Instructions can be found in the bug
- Place stopwords.txt from bug 463708 in /usr/local/sphinx/index. Make sure permissions follow the directory it is in.
- Execute the search daemon /usr/local/sphinx/bin/searchd.
- (optional): Configure the search daemon to start on startup automatically. This is a good idea since searchd needs to be running for any search function to work.
- Execute the MySQL update file from bug 463708 on your SUMO database.
- Execute the MySQL update file from bug 470550 to change `se_words` into a real table from a memory table.
- Edit the options in search.conf.php.dist in the /trunk/scripts/ folder to fit your specific install and save it as search.conf.php in the same folder.
Indexing Sphinx Search
Initial Indexing Instructions
Indexing SUMO with Sphinx for the first time requires a bit of special care. The original draft of these directions can be found in attachment 360993 in bug 460213.
- Deploy all scripts/sphinx/<filename>.dist (stopwords.txt.dist, weight_weights.txt.dist, etc.) to scripts/sphinx/<filename> and set read/writable by apache
- On each of the webheads where sphinx is running, modify the line /etc/sphinx.conf:51 that reads "stopwords = /usr/local/sphinx/index/stopwords.txt" and replace it with "stopwords = <path to svn co>/scripts/sphinx/stopwords.txt". Do the same for /etc/sphinx.conf:98.
- On each of the webheads where sphinx is running, delete lastindexingtime.txt and lastindexingtime-f.txt
- On each of the webheads where sphinx is running, stop searchd: /usr/bin/searchd --stop
- On each of the webheads where sphinx is running, delete all the files in /usr/local/sphinx/index
- On each of the webheads where sphinx is running, in webroot, run "php manual_index.php"
- On each of the webheads where sphinx is running, in webroot, run "php manual_index_forums.php"
- On each of the webheads where sphinx is running, verify that lastindexingtime.txt and lastindexingtime-f.txt are created in webroot
- On each of the webheads where sphinx is running, run "/usr/bin/indexer --all"
- On each of the webheads where sphinx is running, in /usr/local/sphinx/index, do "touch documents.spl"
- On each of the webheads where sphinx is running, in /usr/local/sphinx/index, do "touch forums.spl"
- On each of the webheads where sphinx is running, start sphinx searchd: /usr/bin/searchd
Future Indexing Instructions
The original draft of these directions can be found in attachment 360993 in bug 460213.
- On each of the webheads where sphinx is running, in webroot, run "php manual_index.php"
- On each of the webheads where sphinx is running, in webroot, run "php manual_index_forums.php"
- On each of the webheads where sphinx is running, run "/usr/bin/indexer --all --rotate"
Common Errors
XML parse error: undefined entity
This XML error appears while running indexer --all in the form of "ERROR: index '<index name>': source '<source name>': XML parse error: undefined entity". This error occurs when malformed XML is outputted by /scripts/sphinx/indexer.php (or its forum-specific alternative).
XML parse error: no element found
This XML error appears while running indexer --all in the form of "ERROR: index '<index name>': source '<source name>': XML parse error: no element found". This occurs when the closing '<sphinx:docset>' tag is missing from the XML documented outputted by /scripts/sphinx/indexer.php (or its forum-specific alternative). The cause of this can be any sort of fatal error that prevents the script from finishing.