2019-04-22 11:37:43 +02:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
|
2020-08-17 20:32:42 +02:00
|
|
|
define('SPHINX_VERSION', 331); // If you have sphinx-3.3.1, then set SPHINX_VERSION to 331
|
2019-04-22 11:37:43 +02:00
|
|
|
define('LOCALSTATEDIR', '@LOCALSTATEDIR@');
|
|
|
|
define('NGRAM_CONFIG', " #ngram_len = 1\n #ngram_chars = U+3000..U+2FA1F\n");
|
|
|
|
|
2019-06-23 13:52:46 +02:00
|
|
|
# See http://sphinxsearch.com/wiki/doku.php?id=charset_tables for more on the charset_table settings
|
|
|
|
# The following settings contains English and some Latin extras
|
|
|
|
define('SPHINX_CHARSET_TABLE', "0..9, english, _, \
|
|
|
|
U+C1->U+E1, U+C4->U+E4, U+C5->U+E5, U+C6->U+E6, U+C9->U+E9, U+CD->U+ED, U+D3->U+F3, U+D6->U+F6, U+D8->U+F8, \
|
|
|
|
U+DA->U+FA, U+DC->U+FC, U+0150->U+0151, U+0152->U+0153, U+0170->U+0171, U+01E2->U+E6, U+01E3->U+E6, U+01FC->U+E6, \
|
|
|
|
U+01FD->U+E6, U+1D01->U+E6, U+1D02->U+E6, U+1D2D->U+E6, U+1D46->U+E6, \
|
|
|
|
U+DF, U+E1, U+E4, U+E5, U+E6, U+E9, U+ED, U+00F3, U+F6, U+F8, U+FA, U+FC, U+0151, U+0153, U+0171\n");
|
|
|
|
|
2020-07-18 15:21:50 +02:00
|
|
|
// Sphinx 3.3.1 introduced some strict rules for fulltext search column names
|
|
|
|
// In order to comply with it you must enable SPHINX_STRICT_SCHEMA variable
|
|
|
|
// Be sure to check out http://www.mailpiler.org/wiki/current:sphinx3 for more
|
|
|
|
// NB: The SPHINX_STRICT_SCHEMA in sphinx.conf MUST BE THE SAME as in config.php (or in config-site.php)
|
|
|
|
//
|
2020-08-17 20:32:42 +02:00
|
|
|
define('SPHINX_STRICT_SCHEMA', 1);
|
2020-07-18 15:21:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
if(SPHINX_STRICT_SCHEMA) {
|
|
|
|
define('SELECT_FIELDS', 'id, `from` as sender, `to` as rcpt, `fromdomain` as senderdomain, `todomain` as rcptdomain, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types`');
|
|
|
|
} else {
|
|
|
|
define('SELECT_FIELDS', 'id, `from`, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types`');
|
|
|
|
}
|
2020-07-18 14:29:31 +02:00
|
|
|
|
2019-04-22 11:37:43 +02:00
|
|
|
?>
|
|
|
|
|
2011-11-14 15:57:52 +01:00
|
|
|
#
|
2013-08-18 13:59:55 +02:00
|
|
|
# minimal sphinx configuration suited to piler
|
2011-11-14 15:57:52 +01:00
|
|
|
#
|
|
|
|
|
2013-03-17 14:24:42 +01:00
|
|
|
source base
|
2011-11-14 15:57:52 +01:00
|
|
|
{
|
|
|
|
type = mysql
|
2013-03-24 18:24:08 +01:00
|
|
|
sql_host = MYSQL_HOSTNAME
|
|
|
|
sql_db = MYSQL_DATABASE
|
|
|
|
sql_user = MYSQL_USERNAME
|
|
|
|
sql_pass = MYSQL_PASSWORD
|
2011-11-14 15:57:52 +01:00
|
|
|
|
|
|
|
sql_attr_uint = size
|
2011-11-28 14:21:14 +01:00
|
|
|
sql_attr_uint = sent
|
|
|
|
sql_attr_uint = attachments
|
2011-11-14 15:57:52 +01:00
|
|
|
}
|
|
|
|
|
2013-03-17 14:24:42 +01:00
|
|
|
source delta : base
|
2011-11-14 15:57:52 +01:00
|
|
|
{
|
2017-06-24 08:07:38 +02:00
|
|
|
sql_query_pre = SET NAMES utf8mb4
|
2016-12-13 21:25:39 +01:00
|
|
|
sql_query_pre = REPLACE INTO sph_counter SELECT 1, IFNULL(MAX(id), 0) FROM sph_index
|
2011-11-14 15:57:52 +01:00
|
|
|
sql_query_post_index = DELETE FROM sph_index WHERE id<=(SELECT max_doc_id FROM sph_counter WHERE counter_id=1)
|
2020-07-18 14:29:31 +02:00
|
|
|
sql_query = SELECT <?php print SELECT_FIELDS; ?> FROM sph_index WHERE id <= (SELECT max_doc_id FROM sph_counter WHERE counter_id=1)
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2020-02-23 15:06:15 +01:00
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2012-01-07 00:00:36 +01:00
|
|
|
sql_query_killlist = SELECT `id` FROM `metadata` WHERE `deleted`=1
|
2020-02-23 15:06:15 +01:00
|
|
|
<?php } else { ?>
|
|
|
|
sql_query_kbatch = SELECT `id` FROM `metadata` WHERE `deleted`=1
|
|
|
|
<?php } ?>
|
2013-03-31 15:50:39 +02:00
|
|
|
}
|
2011-11-28 14:21:14 +01:00
|
|
|
|
2013-03-31 15:50:39 +02:00
|
|
|
source main1 : base
|
|
|
|
{
|
2017-06-24 08:07:38 +02:00
|
|
|
sql_query_pre = SET NAMES utf8mb4
|
2020-07-18 14:29:31 +02:00
|
|
|
sql_query = SELECT <?php print SELECT_FIELDS; ?> FROM sph_index WHERE id=-1
|
2011-11-14 15:57:52 +01:00
|
|
|
}
|
|
|
|
|
2013-03-31 15:50:39 +02:00
|
|
|
source main2 : base
|
|
|
|
{
|
2017-06-24 08:07:38 +02:00
|
|
|
sql_query_pre = SET NAMES utf8mb4
|
2020-07-18 14:29:31 +02:00
|
|
|
sql_query = SELECT <?php print SELECT_FIELDS; ?> FROM sph_index WHERE id=-1
|
2013-03-31 15:50:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
source main3 : base
|
|
|
|
{
|
2017-06-24 08:07:38 +02:00
|
|
|
sql_query_pre = SET NAMES utf8mb4
|
2020-07-18 14:29:31 +02:00
|
|
|
sql_query = SELECT <?php print SELECT_FIELDS; ?> FROM sph_index WHERE id=-1
|
2013-03-31 15:50:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
source main4 : base
|
|
|
|
{
|
2017-06-24 08:07:38 +02:00
|
|
|
sql_query_pre = SET NAMES utf8mb4
|
2020-07-18 14:29:31 +02:00
|
|
|
sql_query = SELECT <?php print SELECT_FIELDS; ?> FROM sph_index WHERE id=-1
|
2013-03-31 15:50:39 +02:00
|
|
|
}
|
2012-01-07 00:00:36 +01:00
|
|
|
|
2013-07-08 11:31:17 +02:00
|
|
|
source dailydelta : base
|
|
|
|
{
|
2017-06-24 08:07:38 +02:00
|
|
|
sql_query_pre = SET NAMES utf8mb4
|
2020-07-18 14:29:31 +02:00
|
|
|
sql_query = SELECT <?php print SELECT_FIELDS; ?> FROM sph_index WHERE id=-1
|
2013-07-08 11:31:17 +02:00
|
|
|
}
|
|
|
|
|
2013-03-17 14:24:42 +01:00
|
|
|
source tag : base
|
2011-12-05 17:18:03 +01:00
|
|
|
{
|
2017-06-24 08:07:38 +02:00
|
|
|
sql_query_pre = SET NAMES utf8mb4
|
2014-09-22 11:13:55 +02:00
|
|
|
sql_query = SELECT `_id`, `id` AS iid, `uid`, `tag` FROM `tag`
|
2012-09-02 23:18:04 +02:00
|
|
|
|
2014-09-22 11:13:55 +02:00
|
|
|
sql_attr_uint = iid
|
2012-09-02 23:18:04 +02:00
|
|
|
sql_attr_uint = uid
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-03-17 14:24:42 +01:00
|
|
|
source note : base
|
2012-09-02 23:18:04 +02:00
|
|
|
{
|
2017-06-24 08:07:38 +02:00
|
|
|
sql_query_pre = SET NAMES utf8mb4
|
2014-09-22 11:13:55 +02:00
|
|
|
sql_query = SELECT `_id`, `id` AS iid, `uid`, `note` FROM `note`
|
2011-12-06 11:29:36 +01:00
|
|
|
|
2014-09-22 11:13:55 +02:00
|
|
|
sql_attr_uint = iid
|
2011-12-06 11:29:36 +01:00
|
|
|
sql_attr_uint = uid
|
2011-12-05 17:18:03 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-11-14 15:57:52 +01:00
|
|
|
|
|
|
|
index main1
|
|
|
|
{
|
2022-05-31 18:00:58 +02:00
|
|
|
source = main1
|
|
|
|
path = <?php print LOCALSTATEDIR; ?>/piler/sphinx/main1
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2022-05-31 18:00:58 +02:00
|
|
|
docinfo = extern
|
|
|
|
dict = keywords
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php } ?>
|
2015-01-23 10:03:44 +01:00
|
|
|
min_prefix_len = 5
|
2012-08-23 15:06:00 +02:00
|
|
|
min_word_len = 1
|
2019-06-23 13:52:46 +02:00
|
|
|
charset_table = <?php print SPHINX_CHARSET_TABLE; ?>
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php print NGRAM_CONFIG; ?>
|
2011-11-14 15:57:52 +01:00
|
|
|
}
|
|
|
|
|
2013-03-31 15:50:39 +02:00
|
|
|
index main2
|
|
|
|
{
|
|
|
|
source = main2
|
2019-04-22 11:37:43 +02:00
|
|
|
path = <?php print LOCALSTATEDIR; ?>/piler/sphinx/main2
|
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2013-03-31 15:50:39 +02:00
|
|
|
docinfo = extern
|
2022-05-31 18:00:58 +02:00
|
|
|
dict = keywords
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php } ?>
|
2015-01-23 10:03:44 +01:00
|
|
|
min_prefix_len = 5
|
2013-03-31 15:50:39 +02:00
|
|
|
min_word_len = 1
|
2019-06-23 13:52:46 +02:00
|
|
|
charset_table = <?php print SPHINX_CHARSET_TABLE; ?>
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php print NGRAM_CONFIG; ?>
|
2013-03-31 15:50:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
index main3
|
|
|
|
{
|
|
|
|
source = main3
|
2019-04-22 11:37:43 +02:00
|
|
|
path = <?php print LOCALSTATEDIR; ?>/piler/sphinx/main3
|
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2013-03-31 15:50:39 +02:00
|
|
|
docinfo = extern
|
2022-05-31 18:00:58 +02:00
|
|
|
dict = keywords
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php } ?>
|
2015-01-23 10:03:44 +01:00
|
|
|
min_prefix_len = 5
|
2013-03-31 15:50:39 +02:00
|
|
|
min_word_len = 1
|
2019-06-23 13:52:46 +02:00
|
|
|
charset_table = <?php print SPHINX_CHARSET_TABLE; ?>
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php print NGRAM_CONFIG; ?>
|
2013-03-31 15:50:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
index main4
|
|
|
|
{
|
|
|
|
source = main4
|
2019-04-22 11:37:43 +02:00
|
|
|
path = <?php print LOCALSTATEDIR; ?>/piler/sphinx/main4
|
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2013-03-31 15:50:39 +02:00
|
|
|
docinfo = extern
|
2022-05-31 18:00:58 +02:00
|
|
|
dict = keywords
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php } ?>
|
2015-01-23 10:03:44 +01:00
|
|
|
min_prefix_len = 5
|
2013-03-31 15:50:39 +02:00
|
|
|
min_word_len = 1
|
2019-06-23 13:52:46 +02:00
|
|
|
charset_table = <?php print SPHINX_CHARSET_TABLE; ?>
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php print NGRAM_CONFIG; ?>
|
2013-03-31 15:50:39 +02:00
|
|
|
}
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2013-07-08 11:31:17 +02:00
|
|
|
index dailydelta1
|
|
|
|
{
|
|
|
|
source = dailydelta
|
2019-04-22 11:37:43 +02:00
|
|
|
path = <?php print LOCALSTATEDIR; ?>/piler/sphinx/dailydelta1
|
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2013-07-08 11:31:17 +02:00
|
|
|
docinfo = extern
|
2022-05-31 18:00:58 +02:00
|
|
|
dict = keywords
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php } ?>
|
2015-01-23 10:03:44 +01:00
|
|
|
min_prefix_len = 5
|
2013-07-08 11:31:17 +02:00
|
|
|
min_word_len = 1
|
2019-06-23 13:52:46 +02:00
|
|
|
charset_table = <?php print SPHINX_CHARSET_TABLE; ?>
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php print NGRAM_CONFIG; ?>
|
2013-07-08 11:31:17 +02:00
|
|
|
}
|
|
|
|
|
2011-11-14 15:57:52 +01:00
|
|
|
index delta1
|
|
|
|
{
|
|
|
|
source = delta
|
2019-04-22 11:37:43 +02:00
|
|
|
path = <?php print LOCALSTATEDIR; ?>/piler/sphinx/delta1
|
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2011-11-14 15:57:52 +01:00
|
|
|
docinfo = extern
|
2022-05-31 18:00:58 +02:00
|
|
|
dict = keywords
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php } ?>
|
2015-01-23 10:03:44 +01:00
|
|
|
min_prefix_len = 5
|
2012-08-23 15:06:00 +02:00
|
|
|
min_word_len = 1
|
2019-06-23 13:52:46 +02:00
|
|
|
charset_table = <?php print SPHINX_CHARSET_TABLE; ?>
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php print NGRAM_CONFIG; ?>
|
|
|
|
<?php if(SPHINX_VERSION >= 310) { ?>
|
|
|
|
kbatch = main1, main2, main3, main4, dailydelta1
|
|
|
|
<?php } ?>
|
2011-11-14 15:57:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-12-05 17:18:03 +01:00
|
|
|
index tag1
|
|
|
|
{
|
|
|
|
source = tag
|
2019-04-22 11:37:43 +02:00
|
|
|
path = <?php print LOCALSTATEDIR; ?>/piler/sphinx/tag1
|
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2011-12-05 17:18:03 +01:00
|
|
|
docinfo = extern
|
2022-05-31 18:00:58 +02:00
|
|
|
dict = keywords
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php } ?>
|
2015-01-23 10:03:44 +01:00
|
|
|
min_prefix_len = 5
|
2012-08-23 15:06:00 +02:00
|
|
|
min_word_len = 1
|
2019-06-23 13:52:46 +02:00
|
|
|
charset_table = <?php print SPHINX_CHARSET_TABLE; ?>
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php print NGRAM_CONFIG; ?>
|
2011-12-05 17:18:03 +01:00
|
|
|
}
|
|
|
|
|
2011-11-14 15:57:52 +01:00
|
|
|
|
2012-09-02 23:18:04 +02:00
|
|
|
index note1
|
|
|
|
{
|
|
|
|
source = note
|
2019-04-22 11:37:43 +02:00
|
|
|
path = <?php print LOCALSTATEDIR; ?>/piler/sphinx/note1
|
|
|
|
<?php if(SPHINX_VERSION < 300) { ?>
|
2012-09-02 23:18:04 +02:00
|
|
|
docinfo = extern
|
2022-05-31 18:00:58 +02:00
|
|
|
dict = keywords
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php } ?>
|
2015-01-23 10:03:44 +01:00
|
|
|
min_prefix_len = 5
|
2012-09-02 23:18:04 +02:00
|
|
|
min_word_len = 1
|
2019-06-23 13:52:46 +02:00
|
|
|
charset_table = <?php print SPHINX_CHARSET_TABLE; ?>
|
2019-04-22 11:37:43 +02:00
|
|
|
<?php print NGRAM_CONFIG; ?>
|
2015-04-27 14:30:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-14 15:57:52 +01:00
|
|
|
indexer
|
|
|
|
{
|
2022-05-31 18:00:58 +02:00
|
|
|
mem_limit = 256M
|
2011-11-14 15:57:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
searchd
|
|
|
|
{
|
2022-05-31 18:00:58 +02:00
|
|
|
listen = 127.0.0.1:9312
|
|
|
|
listen = 127.0.0.1:9306:mysql41
|
|
|
|
log = /dev/null
|
|
|
|
binlog_path =
|
|
|
|
##query_log =
|
|
|
|
read_timeout = 5
|
|
|
|
max_children = 30
|
|
|
|
pid_file = /var/run/piler/searchd.pid
|
|
|
|
seamless_rotate = 1
|
|
|
|
preopen_indexes = 1
|
|
|
|
unlink_old = 1
|
|
|
|
thread_stack = 512k
|
|
|
|
workers = thread_pool
|
2011-11-14 15:57:52 +01:00
|
|
|
}
|