changeset 7566:8ae86f73f80d HEAD

Fixes to sort indexing.
author Timo Sirainen <tss@iki.fi>
date Thu, 29 May 2008 07:05:18 +0300
parents 6930859e7a5a
children 9c0d2413735d
files src/lib-storage/index/index-sort-string.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-sort-string.c	Thu May 29 06:17:24 2008 +0300
+++ b/src/lib-storage/index/index-sort-string.c	Thu May 29 07:05:18 2008 +0300
@@ -366,8 +366,14 @@
 
 	*idx_r = idx;
 	if (idx > start_idx) {
-		*prev_str_r = index_sort_get_string(ctx, idx - 1,
-						    nodes[idx-1].seq);
+		prev = idx;
+		do {
+			prev--;
+			str2 = index_sort_get_string(ctx, prev,
+						     nodes[prev].seq);
+		} while (str2 == &expunged_msg && prev > 0 &&
+			 nodes[prev-1].sort_id == nodes[prev].sort_id);
+		*prev_str_r = str2;
 	}
 }
 
@@ -408,7 +414,7 @@
 
 		if (ret <= 0) {
 			array_append(&ctx->sorted_nodes, &znodes[zpos], 1);
-			prev_str = nzstr;
+			prev_str = zstr;
 			zpos++;
 		} else {
 			array_append(&ctx->sorted_nodes, &nznodes[nzpos], 1);