sphinx documentation and sample config file

darcs-hash:20081124023036-099f7-d2c32538e8a81170032ba0bc9fc5caf79e2b59a9.gz
This commit is contained in:
millette 2008-11-23 21:30:36 -05:00
parent 64d2709bcd
commit 525b867718
3 changed files with 104 additions and 2 deletions

33
README
View File

@ -141,7 +141,11 @@ For some functionality, you will also need the following extensions:
server to store the data in. server to store the data in.
- Mailparse. Efficient parsing of email requires this extension. - Mailparse. Efficient parsing of email requires this extension.
Submission by email or SMS-over-email uses this extension. Submission by email or SMS-over-email uses this extension.
- Sphinx Search. A client for the sphinx server, an alternative
to MySQL or Postgresql fulltext search. You will also need a
Sphinx server to serve the search queries.
You will almost definitely get 2-3 times better performance from your You will almost definitely get 2-3 times better performance from your
site if you install a PHP bytecode cache/accelerator. Some well-known site if you install a PHP bytecode cache/accelerator. Some well-known
examples are: eaccelerator, Turck mmcache, xcache, apc. Zend Optimizer examples are: eaccelerator, Turck mmcache, xcache, apc. Zend Optimizer
@ -590,6 +594,22 @@ backups of a working Laconica system by backing up the database and
the Web directory. To backup the database use mysqldump (http://ur1.ca/7xo) the Web directory. To backup the database use mysqldump (http://ur1.ca/7xo)
and to backup the Web directory, try tar. and to backup the Web directory, try tar.
Sphinx
------
To use a Sphinx server to search users and notices, you also need
to install, compile and enable the sphinx pecl extension for php on the
client side, which itself depends on the sphinx development files.
"pecl install sphinx" should take care of that. Add "extension=sphinx.so"
to your php.ini and reload apache to enable it.
You can update your MySQL or Postgresql databases to drop their fulltext
search indexes, since they're now provided by sphinx.
On the sphinx server side, a script reads the main database and build
the keyword index. A cron job reads the database and keeps the sphinx
indexes up to date.
Upgrading Upgrading
========= =========
@ -931,6 +951,17 @@ enabled: Set to true to enable. Default false.
server: a string with the hostname of the memcached server. Can also server: a string with the hostname of the memcached server. Can also
be an array of hostnames, if you've got more than one server. be an array of hostnames, if you've got more than one server.
sphinx
------
You can get a significant boost in performance using Sphinx Search
instead of your database server to search for users and notices.
(http://sphinxsearch.com/).
enabled: Set to true to enable. Default false.
server: a string with the hostname of the sphinx server.
port: an integer with the port number of the sphinx server.
integration integration
----------- -----------

View File

@ -59,7 +59,7 @@ $config['db']['database'] = 'mysql://laconica:microblog@localhost/laconica';
# sphinx search # sphinx search
$config['sphinx']['enabled'] = false; $config['sphinx']['enabled'] = false;
$config['sphinx']['server'] = 'localhost'; $config['sphinx']['server'] = 'localhost';
$config['sphinx']['PORT'] = 3312; $config['sphinx']['port'] = 3312;
# Users to populate the 'Featured' tab # Users to populate the 'Featured' tab

71
sphinx.conf.sample Normal file
View File

@ -0,0 +1,71 @@
#
# Minimal Sphinx configuration sample for laconica
#
source src1
{
type = mysql
sql_host = localhost
sql_user = USERNAME
sql_pass = PASSWORD
sql_db = identi_ca
sql_port = 3306
sql_query = SELECT id, UNIX_TIMESTAMP(created) as created_ts, nickname, fullname, location, bio, homepage FROM profile
sql_query_info = SELECT * FROM profile where id = $id
sql_attr_timestamp = created_ts
}
source src2
{
type = mysql
sql_host = localhost
sql_user = USERNAME
sql_pass = PASSWORD
sql_db = identi_ca
sql_port = 3306
sql_query = SELECT id, UNIX_TIMESTAMP(created) as created_ts, content FROM notice
sql_query_info = SELECT * FROM notice where id = $id
sql_attr_timestamp = created_ts
}
index identica_notices
{
source = src2
path = DIRECTORY/data/identica_notices
docinfo = extern
charset_type = utf-8
min_word_len = 3
stopwords = DIRECTORY/data/stopwords-en.txt
}
index identica_people
{
source = src1
path = DIRECTORY/data/identica_people
docinfo = extern
charset_type = utf-8
min_word_len = 3
stopwords = DIRECTORY/data/stopwords-en.txt
}
indexer
{
mem_limit = 32M
}
searchd
{
port = 3312
log = DIRECTORY/log/searchd.log
query_log = DIRECTORY/log/query.log
read_timeout = 5
max_children = 30
pid_file = DIRECTORY/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
}