slusarz / dovecot-fts-flatcurve

Dovecot FTS Flatcurve plugin (Xapian)
https://slusarz.github.io/dovecot-fts-flatcurve/
GNU Lesser General Public License v2.1
38 stars 8 forks source link

Virtual search doesn't consider unindexed messages #36

Closed edieterich closed 1 year ago

edieterich commented 1 year ago

If I search in a virtual folder with unindexed messages, the index of the underlying real mailbox isn't updated and the search doesn't return all expected matches.

Here's a change to your test suite to reproduce the issue. I simply remove the index of INBOX and repeat the virtual search from before: https://github.com/edieterich/dovecot-fts-flatcurve/commit/2bd8a1b6bd14a9019788cabcbd56c3eaeb5af6eb

The test run fails:

Testing virtual search with unindexed messages
[9867](https://github.com/edieterich/dovecot-fts-flatcurve/actions/runs/3240988370/jobs/5312322483#step:3:9869)
*** Test virtual command 3/10 (line 6)
[9868](https://github.com/edieterich/dovecot-fts-flatcurve/actions/runs/3240988370/jobs/5312322483#step:3:9870)
 - failed: Missing 1 untagged replies (1 mismatches)
[9869](https://github.com/edieterich/dovecot-fts-flatcurve/actions/runs/3240988370/jobs/5312322483#step:3:9871)
 - first unexpanded: search 1 2 3
[9870](https://github.com/edieterich/dovecot-fts-flatcurve/actions/runs/3240988370/jobs/5312322483#step:3:9872)
 - first expanded: search 1 2 3
[9871](https://github.com/edieterich/dovecot-fts-flatcurve/actions/runs/3240988370/jobs/5312322483#step:3:9873)
 - best match: SEARCH 1 3
[9872](https://github.com/edieterich/dovecot-fts-flatcurve/actions/runs/3240988370/jobs/5312322483#step:3:9874)
 - Command: search body body1

A virtual search should update the underlying indexes if necessary, is this correct?

Thank you for your help.

sirainen commented 1 year ago

Michael could maybe look into it further, but the test case is a bit different from the described bug. Removal of INBOX indexes causes already indexed mails to be lost, which Dovecot doesn't currently detect (it would be rather expensive). The description sounds like the search won't index new mails that were never indexed in the first place?

edieterich commented 1 year ago

I thought I had a problem with fts_autoindex = no and doveadm fts-flatcurve remove was an easy way to reproduce it. Since this is not the case and I can't reproduce the original problem with a proper test case I close the issue. Thanks, I learned something.