Skip to content

Commit

Permalink
search_engine: don't reindex message for every attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
rsto committed May 15, 2024
1 parent 1513790 commit e6d778a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions imap/search_engines.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,16 @@ static int flush_withattach(search_text_receiver_t *rx,
ptrarray_t batch = PTRARRAY_INITIALIZER;
int r = 0;

// Load messages containing the attachment parts.
uint32_t prev_uid = 0;
for (int i = 0; i < dynarray_size(withattach); i++) {
struct withattach_record *wa = dynarray_nth(withattach, i);

if (prev_uid == wa->imap_uid)
continue;

prev_uid = wa->imap_uid;

struct index_record record = {0};
r = mailbox_find_index_record(mailbox, wa->imap_uid, &record);
if (r) {
Expand Down

0 comments on commit e6d778a

Please sign in to comment.