On 5/17/22 11:32, PGNet Dev wrote:
Something that is missing from the current instructions is how to initiate a FULL reindex of all data in the dovecot install.

Beyond looping over each $acct

 doveadm fts rescan -u ${acct}
 doveadm index      -u ${acct} -q '*'

I hadn't seen the fts rescan before.  That was what I was missing to make things really clean.  Before I was deleting all the dovecot.*index* files, and now I don't need to do that.  This is my new script, with the old way commented out:

---
#!/bin/sh
DOVECOT_SOLR_URL_BASE="http://localhost:8983/solr/dovecot";
#MAIL_ROOT=/var/vmail

# DO NOT MODIFY BELOW
# WITHOUT GOOD REASON
#
DEL_ALL_QUERY_XML="<delete><query>*:*</query></delete>"
service dovecot stop
curl \
  "${DOVECOT_SOLR_URL_BASE}/update?commit=true&optimize=true" \
  -H "Content-Type: text/xml" \
  --data-binary "${DEL_ALL_QUERY_XML}"
#find ${MAIL_ROOT} -name "dovecot.*index*" -print0 | xargs -0 rm -f
service dovecot start
doveadm force-resync -A '*'
doveadm fts rescan -A
doveadm index -A -q '*'
---

The script stops Dovecot, wipes out the Solr index, then restarts Dovecot and does the doveadm commands necessary for a full reindex of all mailboxes, without specifying them one by one.  The force-resync probably isn't required, but I figure it can't hurt. I've tested this new version a few times.  Good thing a full reindex only takes about ten minutes for my system.

Thanks,
Shawn

Reply via email to