<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 15/04/2019 11:38, Larry Rosenman via
      dovecot wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+S=X750jEYTteCF-B-GcQ7MoAPfYQTZirYoTY1vA6T2ssrGUA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>⌂63% [<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ grep fts1970
          mail/INBOX</div>
        <div>⌂67% [<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] 1 $ mail -s "test
          fts1970" <a href="mailto:ler@lerctr.org"
            moz-do-not-send="true">ler@lerctr.org</a></div>
        <div>test fts1970</div>
        <div><br>
        </div>
        <div>test fts1970</div>
        <div>.</div>
        <div>EOT</div>
        <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ mailq</div>
        <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ grep fts1970 mail/INBOX</div>
        <div>Subject: test fts1970</div>
        <div>test fts1970</div>
        <div>test fts1970</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>Apr 15 04:29:03 thebighonker exim[49528]:
            1hFxvD-000Csq-P6 <= <a href="mailto:ler@lerctr.org"
              moz-do-not-send="true">ler@lerctr.org</a> U=ler P=local
            S=388</div>
          <div>Apr 15 04:29:03 thebighonker dovecot[2507]: lmtp(49364):
            Connect from local</div>
          <div>Apr 15 04:29:03 thebighonker dovecot[2507]: lmtp(<a
              href="http://ler@lerctr.org/49364" moz-do-not-send="true">ler@lerctr.org/49364</a>):
            save: box=INBOX, uid=175402, msgid=<<a
              href="mailto:E1hFxvD-000Csq-P6@thebighonker.lerctr.org"
              moz-do-not-send="true">E1hFxvD-000Csq-P6@thebighonker.lerctr.org</a>>,
            size=640, vsize=660, from=Larry Rosenman <<a
              href="mailto:ler@lerctr.org" moz-do-not-send="true">ler@lerctr.org</a>>,
            subject=test fts1970, flags=()</div>
          <div>Apr 15 04:29:03 thebighonker dovecot[2507]: lmtp(<a
              href="http://ler@lerctr.org/49364" moz-do-not-send="true">ler@lerctr.org/49364</a>):
            sieve: msgid=<<a
              href="mailto:E1hFxvD-000Csq-P6@thebighonker.lerctr.org"
              moz-do-not-send="true">E1hFxvD-000Csq-P6@thebighonker.lerctr.org</a>>:
            stored mail into mailbox 'INBOX' (subject=test fts1970 from=<a
              href="mailto:ler@lerctr.org" moz-do-not-send="true">ler@lerctr.org</a>
            size=660)</div>
          <div>Apr 15 04:29:03 thebighonker dovecot[2507]: lmtp(49364):
            Disconnect from local: Client has quit the connection
            (state=READY)</div>
          <div>Apr 15 04:29:03 thebighonker exim[49535]:
            1hFxvD-000Csq-P6 => ler <<a
              href="mailto:ler@lerctr.org" moz-do-not-send="true">ler@lerctr.org</a>>
            R=localuser T=dovecot_lmtp S=404 C="250 2.0.0 <<a
              href="mailto:ler@lerctr.org" moz-do-not-send="true">ler@lerctr.org</a>>
            6ACWMN9OtFzUwAAAu+mOrA Saved" QT=0s DT=0s</div>
          <div>Apr 15 04:29:03 thebighonker exim[49535]:
            1hFxvD-000Csq-P6 Completed QT=0s</div>
          <div>Apr 15 04:29:03 thebighonker dovecot[2507]:
            indexer-worker(<a href="http://ler@lerctr.org/49366"
              moz-do-not-send="true">ler@lerctr.org/49366</a>): Indexed
            1 messages in INBOX (UIDs 175402..175402)</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>⌂81% [<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ doveadm search
            mailbox INBOX  body 'fts1970'</div>
          <div>⌂83% [<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>⌂65% [<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] 75 $ doveadm search
            -u <a href="mailto:ler@lerctr.org" moz-do-not-send="true">ler@lerctr.org</a> 
            mailbox INBOX body 'fts1970'</div>
          <div>a53a143be44bda5bd4830000bbe98eac 175402</div>
          <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ doveadm index -q INBOX</div>
          <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ doveadm search mailbox
            INBOX  body 'fts1970'</div>
          <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ doveadm fts rescan</div>
          <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ doveadm index -q INBOX</div>
          <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ doveadm search mailbox
            INBOX  body 'fts1970'</div>
          <div>a53a143be44bda5bd4830000bbe98eac 175402</div>
          <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ doveadm search -u <a
              href="mailto:ler@lerctr.org" moz-do-not-send="true">ler@lerctr.org</a> 
            mailbox INBOX body 'fts1970'</div>
          <div>a53a143be44bda5bd4830000bbe98eac 175402</div>
          <div>[<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $</div>
        </div>
        <div><br>
        </div>
        <div>So, yes, your hypothesis is correct.</div>
        <div><br>
        </div>
        <div>Question: How can I make it consistent?  </div>
        <div><br>
        </div>
        <div>I have a script that runs on the first of the month that
          does archiving, and I have similar issues in that namespace:</div>
        <div>
          <div>⌂67% [<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $ cat
            bin/archive-mail</div>
          <div>#!/bin/sh</div>
          <div>PATH=$PATH:/usr/local/bin</div>
          <div>#Expects to be run after midnight on the first of the
            month</div>
          <div>#  to archive all the previous months mail</div>
          <div>#Date Run:</div>
          <div>TODAY=`date "+%Y-%m-%d"`</div>
          <div>#last month in YYYY/MM</div>
          <div>YEAR_LAST_MONTH=`date -v-1d "+%Y/%m"`</div>
          <div>#1st of last month as 01-Mon-YYYY</div>
          <div>FIRST_LAST_MONTH=`date -v-1d "+01-%b-%Y"`</div>
          <div>echo 'TODAY=' ${TODAY}</div>
          <div>echo 'YEAR_LAST_MONTH=' ${YEAR_LAST_MONTH}</div>
          <div>echo 'FIRST_LAST_MONTH=' ${FIRST_LAST_MONTH}</div>
          <div># get a list of all the mailboxes with at least one real
            message</div>
          <div>doveadm -f tab mailbox status vsize \* 2>/dev/null |</div>
          <div>        sed -e 1d | sort -k 1,1 |</div>
          <div>        awk  'BEGIN {FS="\t"} {if ($2 > 0)  print $1}'
            |</div>
          <div>while read i</div>
          <div>do</div>
          <div>   echo `date` start ${i}</div>
          <div>   doveadm mailbox create
            "ARCHIVE/${YEAR_LAST_MONTH}/${i}"</div>
          <div>   doveadm -f tab mailbox status messages "${i}"</div>
          <div>   doveadm move "ARCHIVE/${YEAR_LAST_MONTH}/${i}" mailbox
            \</div>
          <div>            "${i}" BEFORE ${TODAY} SINCE
            ${FIRST_LAST_MONTH}</div>
          <div>   doveadm -f tab mailbox status messages "${i}"</div>
          <div>   echo `date` done  ${i}</div>
          <div>done</div>
          <div>⌂64% [<a class="moz-txt-link-abbreviated" href="mailto:ler@thebighonker.lerctr.org:~">ler@thebighonker.lerctr.org:~</a>] $</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>The Exim config can be provided as well if necessary.</div>
        <div><br>
        </div>
        <div>ler & <a href="mailto:ler@lerctr.org"
            moz-do-not-send="true">ler@lerctr.org</a> *ARE THE SAME
          MAILBOX*</div>
        <div><br>
        </div>
      </div>
    </blockquote>
    <p>At the moment it looks as though you have two sets of emails
      indexed in solr. One is indexed under username (the one you are
      running mannually and apparently the one used by roundcube too,
      but that's to be verified) and another set being indexed by
      autoindex = yes option using the full email address. Once you've
      got it working as you require, then you may want to clean out solr
      and reindex with just one of them just to reduce volumes.<br>
    </p>
    <p>Your setup seems to have a mix of users from mysql and from
      /etc/passwd. Not sure if your mysql users are all mapped to real
      users or they have their own mailboxes with domain included. Your
      solution will depend on what you really need and if the setup is
      working correctly you may not want to tweak it too much or other
      things may start breaking.</p>
    <p>The simplest thing that comes to mind (providing your manually
      indexed mails show up in roundcube searches) is just to turn off
      autoindex and schedule indexing from cron. As things stand I
      believe autoindex works well with virtual users username@domain.
      You'll probably need to start off with a rescan if you do this.</p>
    <p>If you can swith to all virtual users without local users then
      probably you can use autoindex, but I can understand that may not
      be possible. For sure I'd recommend doing it in a test environment
      first so you can be sure of the configuration and then look at
      migrating your existing mailboxes over to virtual users.<br>
    </p>
    <p>John<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
  </body>
</html>