Extension:SphinxSearch/Windows install

Step 1 - Install Sphinx
(text copied from http://sphinxsearch.com/docs/current.html#installation and modified where appropriate) Extract everything from the .zip file you have downloaded - sphinx-0.9.8-win32.zip (or sphinx-0.9.8-win32-pgsql.zip if you need PostgresSQL support as well.) You can use Windows Explorer in Windows XP and up to extract the files, or a freeware package like 7Zip to open the archive.

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

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 one batch file wiki_main.bat that contain  \indexer.exe --quiet --config \sphinx.conf wiki_main --rotate
 * 2) Create one batch file wiki_incremental.bat that contain  \indexer.exe --quiet --config \sphinx.conf wiki_incremental --rotate
 * 3) Using the help of Invisible Batch File and create a " \bin\invisible.vbs" file that contains CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, 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 " \bin\invisible.vbs" " \Sphinx\bin\wiki_incremental.bat"

Problems on Windows Vista / Windows 7
We are testing searchd on Vista and Windows 7 where the searchd daemon does not return any search results but since the test php-scripts that are coming with the standard sphinx interface itself not working we are guessing it is a problem inherited in the SphinxSearch and not related to the Mediawiki/SphinxSearch interface. We created a forum post Sphinx forum post/searchd and Windows for any follow up's. --MWJames 18:00, 4 May 2010 (UTC)
 * On Windows Vista we had to change $wgSphinxSearch_host from localhost to 127.0.0.1 in the SphinxSearch.php file.

$wgSphinxSearch_host = '127.0.0.1'; $wgSphinxSearch_port = 9312;
 * 1) Host and port on which searchd deamon is tunning
 * I've had the same issue and after some searching found that I started the search daemon with config file C:\Sphinx\sphinx.conf instead of the sphinx.conf file from the extension. I started over completely as my config files were messed up by continuous tinkering anyway, and this time made sure to always use the sphinx.conf file from the extension when there was a config needed (indexer, search deamon registration as service, ...). Now it works like a charm.