Extension:SphinxSearch/Windows install

From MediaWiki.org
Jump to: navigation, search

Contents

[edit] Step 1 - Install Sphinx

The first step when installing [1] Sphinx on Windows is to extract everything from the .zip[2] file you have downloaded[3] (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.

[edit] Other tutorials

[edit] 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 to make sure that the service starts successfully in windows
Configuration sphinx.conf file

[edit] Step 3 - Run Sphinx Indexer

Running an incremental indexing process in command shell mode

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.

[edit] Step 4 - Test Out Sphinx

Actual search process from Mediawiki displayed in command shell mode

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.

[edit] 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.

[edit] 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.

[edit] 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
    <windows path>\system32\wscript.exe "C:\Sphinx\invisible.vbs" "C:\Sphinx\wiki_incremental.bat"
    

[edit] Step 7 - Extension Preparation - Sphinx PHP API

See Step 7 - Extension Preparation - Sphinx PHP API

[edit] Step 8 - Extension Installation - PHP Files

See Step 8 - Extension Installation - PHP Files

[edit] Step 9 - Extension Installation - Local Settings

See Step 9 - Extension Installation - Local Settings

[edit] 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.

[edit] Notes

  1. Some information have been copied from http://sphinxsearch.com/docs/current.html#installation and modified where appropriate
  2. Use Windows Explorer in Windows XP and or any other freeware package like 7Zip to open the archive.
  3. See http://sphinxsearch.com/downloads/
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox