Extension:SphinxSearch/Windows install

Step 1 - Install Sphinx
The first step when installing Sphinx on Windows is to extract everything from the .zip file you have downloaded (such as sphinx-0.9.9-win32.zip or sphinx-0.9.9-win32-pgsql.zip if you need PostgresSQL support as well.) into a folder.

For the remainder of this guide, we will assume that the folders are unzipped into C:\Sphinx, so that searchd.exe can be found in C:\Sphinx\bin\searchd.exe. If you decide to use a different location for the folders or configuration file, please change it accordingly.

A "How to install Sphinx on Windows Video Tutorial" can be found on youtube.

Step 2 - Configure Sphinx

 * 1) Open the extension archive (e.g. SphinxSearch-trunk-r97051.tar.gz) and extract sphinx.conf to the Sphinx folder (C:\Sphinx).
 * 2) Edit the contents of C:\Sphinx\sphinx.conf. Look for sql_db, sql_user, sql_pass, path, log, query_log and pid_file variables. Create the paths as necessary. Make sure you use backslashes (\) instead of forward slashes (/).

Step 3 - Run Sphinx Indexer
Run the sphinx indexer to prepare for searching: C:\Sphinx\bin\indexer --config C:\Sphinx\sphinx.conf --all Once again, make sure to replace the paths to match your installation. This process is actually pretty fast, but clearly depends on how large your wiki is. Just be patient and watch the screen for updates.

Step 4 - Test Out Sphinx
When the indexer is finished, test that sphinx searching is actually working: C:\Sphinx\bin\search --config C:\Sphinx\sphinx.conf "search string" You will see the result stats immediately (Sphinx is FAST.) Note that the article data you see at this point comes from the sql_query_info in sphinx.conf file. In the extension we can get to the actual article content because we have text old_id available as an extra attribute. It would be slow to fetch article content on the command line (we would have to join page, revision, and text tables,) so we just fetch page_title and page_namespace at this point.

Step 5 - Start Sphinx Daemon
To create the windows service ... C:\Sphinx\bin\searchd.exe --install  --config C:\Sphinx\sphinx.conf --servicename SphinxSearch

Start the service c:\> sc start SphinxSearch

If it fails, double check your sphinx.conf file. Make sure the paths are set properly in the searchd section.

Step 6 - Configure Incremental Updates
Use the Windows Task Scheduler, found under Accessories | System Tools | Scheduled Tasks

Create two jobs. One to run once a day and one to run as needed for incremental updates. If you use the scheduler there will not be any command pop ups.

If you get "ERROR: index 'wiki_main': column number 1 has no name." when trying to index, copy libmysql.dll from MySQL 5.0.37 into Sphinx bin directory. For some reason 5.1 version does not work with Sphinx on Windows.

Incremental Update and Windows Task Scheduler
As for the index update the windows task scheduler has to run the indexer.exe therefore one solution to avoid unnecessary command pop up in Windows is:
 * 1) Create a batch file C:\Sphinx\wiki_main.bat that contains C:\Sphinx\bin\indexer.exe --quiet --config C:\Sphinx\sphinx.conf wiki_main --rotate
 * 2) Create another batch file C:\Sphinx\wiki_incremental.bat that contains C:\Sphinx\bin\indexer.exe --quiet --config C:\Sphinx\sphinx.conf wiki_incremental --rotate
 * 3) Using the help of Invisible Batch File and create a C:\Sphinx\invisible.vbs file that contains CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False this will help to set the batch file invisible
 * 4) After this the task scheduler can be run with a command like \system32\wscript.exe "C:\Sphinx\invisible.vbs" "C:\Sphinx\wiki_incremental.bat"

Step 7 - Extension Preparation - Sphinx PHP API
See Step 7 - Extension Preparation - Sphinx PHP API

Step 8 - Extension Installation - PHP Files
See Step 8 - Extension Installation - PHP Files

Step 9 - Extension Installation - Local Settings
See Step 9 - Extension Installation - Local Settings

Windows troubleshooting
Problems and issues of a more general nature should be found on the troubleshooting page, otherwise you might find help on the talk page.

localhost vs. 127.0.0.1
Windows Vista and Windows 7 showed problems when $wgSphinxSearch_host is maintained as localhost therefore it is recommended that instead of localhost one uses 127.0.0.1 instead. The standard configuration should look like: $wgSphinxSearch_host = '127.0.0.1'; $wgSphinxSearch_port = 9312;
 * 1) Host and port on which searchd deamon is tunning

Copy the sphinx.conf file from the extension folder
Please ensure that when using Sphinx, you copied the sphinx.conf from the extension folder into the C:\Sphinx\ folder. Sometimes it happens that people displace the sphinx.conf file and can therefore not establish any connection between Mediawiki and Sphinx.

Windows 7 and Indexer
Some users reported that the file Msvcr71.dll is necessary for running the Indexer successful on Windows 7, on how to solve this problem see.