attachment search

This commit is contained in:
SJ 2015-04-27 14:30:08 +02:00
parent b4805171a2
commit 0e3f2836fe
3 changed files with 52 additions and 2 deletions

View File

@ -66,7 +66,6 @@ source tag : base
} }
source note : base source note : base
{ {
sql_query_pre = SET NAMES utf8 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 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 indexer
{ {
mem_limit = 256M mem_limit = 256M

27
util/indexer.attachment.sh Executable file
View File

@ -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

View File

@ -44,7 +44,7 @@ load_default_values() {
make_certificate() { make_certificate() {
if [ ! -f $SYSCONFDIR/piler.pem ]; then if [ ! -f $SYSCONFDIR/piler.pem ]; then
echo -n "Making an ssl certificate ... " 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 cat 1.cert >> $SYSCONFDIR/piler.pem
chmod 600 $SYSCONFDIR/piler.pem chmod 600 $SYSCONFDIR/piler.pem
rm 1.cert rm 1.cert
@ -281,6 +281,7 @@ make_cron_entries() {
echo "### PILERSTART" >> $CRON_TMP echo "### PILERSTART" >> $CRON_TMP
echo "5,35 * * * * $LIBEXECDIR/piler/indexer.delta.sh" >> $CRON_TMP echo "5,35 * * * * $LIBEXECDIR/piler/indexer.delta.sh" >> $CRON_TMP
echo "30 2 * * * $LIBEXECDIR/piler/indexer.main.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 tag1 --rotate" >> $CRON_TMP
echo "*/15 * * * * $INDEXER --quiet note1 --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 echo "30 6 * * * /usr/bin/php $LIBEXECDIR/piler/generate_stats.php --webui $DOCROOT" >> $CRON_TMP