Sphinx help please!

Slavik

XenForo moderator
Staff member
I am looking at using Sphinx on my board (1.2 million posts, needs to be able to search for 3 letter searches) from this thread. http://xenforo.com/community/threads/sphinx-search-engine-v0-0-1.6447/

I have never used it before, so am documenting it as I go so others can follow my footsteps if they want. I got a little stuck so if someone can run through and fill in the blanks, would be great :)

1. Edit the conf file to match your Xenforo data, note the 2 locations that need editing, one for xenforo_thead_src and one for xenforo_post_src

2. Upload the config file to your httpdocs (or other directory)

3. Download Sphinx

Code:
wget [URL]http://www.sphinxsearch.com/downloads/sphinx-1.10-beta.tar.gz[/URL]

4. Decompress files

Code:
tar xzvf sphinx-1.10-beta.tar.gz

5. Install mysql-devel

Code:
yum install mysql-devel

6. Configure and install (note, some steps here may take a little while to happen, so don't freak out if it takes a minute or 2)

Code:
cd sphinx-1.10-beta

Code:
./configure --prefix /usr/local/sphinxbeta --with-mysql

Code:
make

Code:
make install

7. Copy config file

Code:
cd /usr/local/sphinxbeta/etc

Code:
mv /path/to/the/config/file/uploaded/in/step/one/sphinx.conf .

8. Make index directories

Code:
mkdir /usr/local/sphinxbeta/var/data/xenforo_post

Code:
mkdir /usr/local/sphinxbeta/var/data/xenforo_post_delta

Code:
mkdir /usr/local/sphinxbeta/var/data/xenforo_thread

Code:
mkdir /usr/local/sphinxbeta/var/data/xenforo_thread_delta

9. Start indexer

Code:
/usr/local/sphinxbeta/bin/indexer --config  /usr/local/sphinxbeta/etc/sphinx.conf --all

----- Below here is where I get a bit uncertain -----

10. Upload the attached 2 cron files to your server > Have I formatted these correctly? Do they do the right things ect?

11. Change directory to your cron folder.

Code:
cd /etc/cron.d

12. Move the 2 files to cron folder

Code:
mv /path/to/the/uploaded/files/main.sh .

Code:
mv /path/to/the/uploaded/files/delta.sh .

13. Open crontab

Code:
crontab -e

14.????????? What buttons do I press to add the 2 files to cron?

15. Enter the cron jobs

Code:
 */5 * * * * /etc/cron.d/delta.sh

Code:
 0 0 * * * /etc/cron.d/main.sh

16. Save and exit? (what buttons?)

17. Install Xenforo addon.

18. Profit
 

Attachments

I was under the impression you don't edit crontab directly, rather you use "cron" at the command line to inject the job. I'm not anywhere near my box at the moment thought, but have a look around along those lines.

Personally I use Webmin which has a web-based interface for adding cron jobs.

Cheers,
Shaun :D
 
Ok I worked out editing the crontab to do what I want.

Just need to know now if the 2 files i included into the first post do what they are supposed to.
 
imho 17 has to be done much earlier to create some additional tables

but also needed:

17a) rebuild your search index

17b) edit library/XenForo/Search/SourceHandler/Abstract.php
change
Code:
$class = 'XenForo_Search_SourceHandler_MySqlFt';
to
Code:
$class = 'SphinxSearch_Search_Sphinx';
that area changed since the plugin was released

Sphinx has to be started too in between or rotate will fail:
/usr/local/sphinxbeta/bin/searchd --config /usr/local/sphinxbeta/etc/sphinx.conf

working really good here on a testpage. To be sure its working in XF just try a search and check /usr/local/sphinxbeta/var/log/query.log
 
Have you got it working with the delta updates? Just revisiting this and still no idea on setting up 1 minute deltas.
 
Top Bottom