https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-sphinx-on-ubuntu-14-04
The doc under the installation package is not accurate. This article is well written.
In order to keep the index updated in time, add it in crontab and execute index update every hour
@hourly /usr/bin/indexer --rotate --config /etc/sphinxsearch/sphinx.conf --all
execute
search this is my test document number
Error:
The program 'search' is currently not installed. You can install it by typing:
sudo apt-get install sphinxsearch
Conclusion: http://sphinxsearch.com/forum/view.html?id=14124
Looks like search tool got removed in version 2.2.2:
> removed deprecated CLI search and sql_query_info
You are running:
> Sphinx 2.2.10-id64-release
search has been removed!
Also refer to:
http://blog.51yip.com/mysql/1659.html
There are 2 ways to call sphinx through PHP,
1. Add sphinx as a php module
2. Call sphinx api
1. Refer to http://hongtoushizi.iteye.com/ blog/1936938 After
executing
sudo pear install pecl/sphinx
, modify /etc/php5/apache2/php.ini and
add extension=sphinx.so. Then restart apache2. After the installation is successful
, you will see
sphinx
sphinx support enabled
Version 1.3.3
Revision $Revision$
2 API method in phpinfo. Please download
https://github.com/romainneutron/Sphinx-Search-API-PHP-Client
need to use When you need to add require ( "sphinxapi.php" ); the
usage of both methods is the same
$host = "localhost"; $port = 1238; $index = "geostemmed"; $cl = new SphinxClient(); $cl->SetServer ( $host, $port ); $cl->SetSortMode ( SPH_SORT_EXTENDED, "@relevance DESC, @id DESC" ); $cl->SetMatchMode ( $mode ); $cl->SetLimits(0,25); $res = $cl->Query ( $q, $index );