Search based on header / message id / attachment file name
How to enable the search using message id or header or attachment file name.
Comments (7)
-
repo owner -
reporter I want to search (WEB GUI) the mails using Attachment file name (test.xls) or Headers.
-
repo owner Unfortunately these types of searches are not supported. You just can't search for any possible mail headers, and searching for the attachment name is tricky to implement, though I've been giving a lot thinking to the latter. I'll let you if it will be implemented, however I don't plan to index all email headers.
-
repo owner Try the following to enable the search for attachment names. Edit sphinx.conf, and add a new index as follows:
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=aid 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 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 }
Then as user piler create the new index:
indexer --rotate att1
Then restart searchd:
/etc/init.d/rc.searchd
Finally download the latest master branch, and update the gui (only the gui files!)
Now try the following search query:
aname: whatever.doc
or
aname: whatever.doc OR image001.jpg
If you are happy with the result, then add "indexer --rotate att1" to the cron jobs.
A few limitations: 1. you can't use AND operator in this context. 2. You can't search attachment names and other fields (eg. date) at the same time.
Note that this may not be the final implementation for searching attachment names. Let me know how it works for you.
-
repo owner Check if you have write permissions on the DOCROOT/tmp directory for the webserver. At my installation the bulk download also works.
-
repo owner I still believe that it's a local issue. Show me ls -ld /var/www/html/piler/tmp/
Btw. I made a typo in the sql query above. It stands as
where rcpt.id=aid group by
The correct snippet:
where rcpt.id=mid group by
-
repo owner - changed status to resolved
- Log in to comment
Please elaborate what you are trying to do.