diff --git a/etc/sphinx.conf.in b/etc/sphinx.conf.in index a7717ba3..260f1a4f 100644 --- a/etc/sphinx.conf.in +++ b/etc/sphinx.conf.in @@ -66,7 +66,6 @@ source tag : base } - source note : base { sql_query_pre = SET NAMES utf8 @@ -77,6 +76,16 @@ source note : base } +source att : base +{ + + sql_query_pre = SET NAMES utf8 + sql_query = select a.id as aid, m.id as mid, a.name AS aname, a.size, REPLACE(REPLACE(m.`from`, '@', 'X'), '.', 'X') as `from`, REPLACE(REPLACE((select group_concat(rcpt.`to` ORDER BY `to` ASC SEPARATOR ' ') from rcpt where rcpt.id=mid group by rcpt.id), '@', 'X'), '.', 'X') as `to` from attachment a, metadata m where m.piler_id=a.piler_id + + sql_attr_uint = size + sql_attr_uint = mid +} + index main1 { @@ -177,6 +186,19 @@ index note1 } +index att1 +{ + source = att + path = /var/piler/sphinx/att1 + docinfo = extern + dict = keywords + min_prefix_len = 6 + min_word_len = 1 + ngram_len = 1 + ngram_chars = U+1100..U+2FA1F +} + + indexer { mem_limit = 256M diff --git a/util/indexer.attachment.sh b/util/indexer.attachment.sh new file mode 100755 index 00000000..fcbc5803 --- /dev/null +++ b/util/indexer.attachment.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin +DELTATMPFILE=/var/run/piler/delta.attachment.indexer.tmp +INDEXER=indexer +PRIORITY=mail.error +TOUCHFILE=/var/piler/stat/indexer.attachment + +if [ -f $DELTATMPFILE ]; then echo "INDEXER ERROR: att1 indexing is already running. It started at "`cat $DELTATMPFILE` | logger -p $PRIORITY ; exit 1; fi + +date > $DELTATMPFILE + +touch $TOUCHFILE + +function finish { + rm -f $DELTATMPFILE +} + +trap finish EXIT + +echo "INDEXER INFO: indexing att1 started" | logger -p $PRIORITY + +$INDEXER --quiet att1 --rotate + +echo "INDEXER INFO: indexing att1 finished" | logger -p $PRIORITY + + diff --git a/util/postinstall.sh.in b/util/postinstall.sh.in index d7af670a..894f86fe 100755 --- a/util/postinstall.sh.in +++ b/util/postinstall.sh.in @@ -44,7 +44,7 @@ load_default_values() { make_certificate() { if [ ! -f $SYSCONFDIR/piler.pem ]; then echo -n "Making an ssl certificate ... " - openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "$SSL_CERT_DATA" -keyout $SYSCONFDIR/piler.pem -out 1.cert + openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "$SSL_CERT_DATA" -keyout $SYSCONFDIR/piler.pem -out 1.cert -sha1 cat 1.cert >> $SYSCONFDIR/piler.pem chmod 600 $SYSCONFDIR/piler.pem rm 1.cert @@ -281,6 +281,7 @@ make_cron_entries() { echo "### PILERSTART" >> $CRON_TMP echo "5,35 * * * * $LIBEXECDIR/piler/indexer.delta.sh" >> $CRON_TMP echo "30 2 * * * $LIBEXECDIR/piler/indexer.main.sh" >> $CRON_TMP + echo "15,45 * * * * $LIBEXECDIR/piler/indexer.attachment.sh" >> $CRON_TMP echo "*/15 * * * * $INDEXER --quiet tag1 --rotate" >> $CRON_TMP echo "*/15 * * * * $INDEXER --quiet note1 --rotate" >> $CRON_TMP echo "30 6 * * * /usr/bin/php $LIBEXECDIR/piler/generate_stats.php --webui $DOCROOT" >> $CRON_TMP