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.

Other tutorials

 * A "How to install Sphinx on Windows Video Tutorial" can be found on youtube.
 * See Tutorial: Installing on Windows

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 (/).
 * 3) Don't forget to add a binlog_path = line (that points to a real folder) in the searchd section of C:\Sphinx\sphinx.conf to make sure that the service starts successfully in Windows.
 * 4) Add the line compat_sphinxql_magics = 0 to the searchd section of C:\Sphinx\sphinx.conf to avoid "WARNING: compat_sphinxql_magics=1 is deprecated" as of SphinxSearch 2.0.1-beta. (Note: As of 2.2.1 Beta  this feature was removed and including this line will result in an error).

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.

Note: The search.exe program (CLI search) is for testing and debugging purposes only; it is NOT intended for production use. The better options are to use SphinxAPI or SphinxQL.

Step 5 - Start Sphinx Daemon
To create the windows service...  the   option cannot be omitted here by putting sphinx.conf in the C:\Sphinx\bin\ folder. 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.
 * If the error is, then manually create the \binlog folder in the Sphinx install location.
 * If the error is, then run the command prompt with Administrator privileges.

To uninstall the windows service: C:\WINDOWS\system32> C:\Sphinx\bin\searchd.exe --delete --servicename SphinxSearch

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 %windir%\system32\wscript.exe "C:\Sphinx\invisible.vbs" "C:\Sphinx\wiki_incremental.bat"

Step 7 - Extension Preparation - SphinxSearch Folder
See Step 7 - Extension Preparation - SphinxSearch Folder

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

Step 8.2 - Extension Installation - PHP Files
See Step 8.2 - Extension Installation - PHP Files

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

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