Installing Sphinx 0.9.9 from MacPorts

Sphinx 0.9.9 is now available through MacPorts. If you want MacPorts but haven’t got it head on over here.

Install Sphinx

For a new install use the following commands:

sudo port -d selfupdate #this updates the PortFile tree and index
sudo port install sphinx

If you have an older version this should upgrade to 0.9.9

sudo port -d selfupdate  #this updates the PortFile tree and index
sudo port upgrade outdated  #upgrades

Check install

If you don’t remember choosing a different directory on install then you will find MacPorts related stuff (including Sphinx) in /opt/local/

Ensure /opt/local/bin is in $PATH

echo "${PATH//:/$'\n'}"  #display all dirs on path on a separate line

To check the installation here are some commands:

which searchd
which indexer
searchd -h

Setting up config

If this is a fresh install you may need to copy the distribution config from sphinx.conf.dist to sphinx.conf. There is also a file without comments called sphinx-min.conf.dist

cd /opt/local/etc/sphinx/

if [ ! -f sphinx.conf ]
then
sudo cp sphinx.conf.dist sphinx.conf
fi

sudo open sphinx.conf #open the config

port gohome sphinx #opens sphinx homepage

Docs and php API

If you are working with php there is a api file here sphinxapi.php with some docs here

For help setting up indexes here are the Sphinx docs http://sphinxsearch.com/docs/current.html

Some helpful commands for when you are playing around with your sources and indexes.

#watch as connections come in
sudo searchd --console
#this will reindex all and send a signal to the running searchd process to rotate updated indexes automatically
sudo indexer --all --rotate

1 Comment

  1. Well-written article 🙂

Leave a Reply

Your email address will not be published.

*

© 2016 Spirton

Theme by Anders NorenUp ↑