]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: fts_search_get_first_missing_uid() - Set last_indexed_uid_r also when uid is...
authorMarco Bettini <marco.bettini@open-xchange.com>
Mon, 11 Sep 2023 08:16:03 +0000 (08:16 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Tue, 10 Oct 2023 07:13:49 +0000 (07:13 +0000)
Previously last_indexed_uid_r was set only if uid was not found.
Now we set it to the uid provided in input (the functions invoked
do not provide the information).

src/plugins/fts/fts-search.c

index c87d7573c6f90b191ded7955a03d51d28fb306af..14992ebe26068315dc12f983f0831d2470101d10 100644 (file)
@@ -344,21 +344,20 @@ int fts_search_get_first_missing_uid(struct fts_backend *backend,
 {
        uint32_t messages_count = mail_index_view_get_messages_count(box->view);
        uint32_t uid, last_indexed_uid;
-       int ret;
 
        if (messages_count == 0)
                return 1;
 
        mail_index_lookup_uid(box->view, messages_count, &uid);
        for (bool refreshed = FALSE;; refreshed = TRUE) {
-               ret = fts_backend_is_uid_indexed(backend, box, uid,
-                                                &last_indexed_uid);
-               if (ret != 0)
+               int ret = fts_backend_is_uid_indexed(backend, box, uid,
+                                                    &last_indexed_uid);
+               if (ret < 0)
+                       return ret;
+
+               *last_indexed_uid_r = last_indexed_uid;
+               if (ret > 0 || refreshed || backend->updating)
                        return ret;
-               if (refreshed || backend->updating) {
-                       *last_indexed_uid_r = last_indexed_uid;
-                       return 0;
-               }
 
                /* UID doesn't seem to be indexed yet.
                   Refresh FTS and check again. */