Skip to content

glensc/phorum-sphinx_search

Repository files navigation

Module  : Sphinx Search
Version : 1.1.2
Author  : Thomas Seiffert, updated by Martijn van Maasakkers <martijn@vanmaasakkers.net>, Elan Ruusamäe <glen@delfi.ee>

Module for using sphinx as fulltext search-engine instead of phorum built-in search
sphinx can be downloaded and installed from http://sphinxsearch.com/

Installation instructions:
--------------------------

To get this to work you will need to install sphinx on your server.
This will not be possible in a shared hosting environment and no, there
is no workaround for that.

some caveats:
  - data is stored in both phorum_search-table (not needed here) and in the
    sphinx filesystem - this doubles the sizes needed for search even though
    the search-table is not needed. You can clear it out every now and then.
    you may disable filling phorum_search table by setting
    $PHORUM['DBCONFIG']['empty_search_table'] to true in db config.
    but then you need to rebuild search data if you want to go back to mysql
    fulltext search. you can rebuild search data using admin panel.
  - search-data is not updated in real-time - sphinx reindexes the data if the indexer
    is called for the index, which does a full reindexing of the sphinx index.
    There is a workaround available in sphinx http://sphinxsearch.com/doc.html#live-updates
    which works essentially with two indexes. A large one and smaller one with only the deltas
    to the full index and which can be reindexed therefore more often.
    Still, its not realtime.
    For me the full indexing of 350,000 messages took around 5 minutes.
    I'd run the full indexing around once a day with those times.
    See crontab file for sample crontab setup, install it to /etc/cron.d/phorum-sphinx-search

Before you can run a search through sphinx you will need to setup sphinx correctly and do at least one full
indexing of your phorum-data.
Try the searching on the command-line using search from the sphinx install first.
Also you will need to start searchd from sphinx so that the mod can connect to it for searching.

The relevant parts from my sphinx.conf:

You will need to change *AT LEAST* the database settings, i.e. username, password, database-name and maybe
the table name for the messages table used.
If you change the index names you will need to change them in the sphinx_search too.

ATTENTION:

The delta indexes require MySQL-4.1 or higher because of the use of subqueries and they need a separate table
for holding the last indexed ID, its structure is the following (install in phorum database). see sph_counter.sql file.

For Sample (working) sphinx config see sphinx.conf. Make sure to AT LEAST change the database settings.

KNOWN ISSUES:
It is not currently possible to search by author and by messages at the same
time. Search is performed either from phorum5_msg or phorum5_author sphinx
indexes.