changeset 7249:eb310b0d0966 HEAD

Fixed squat lookup.
author Timo Sirainen <tss@iki.fi>
date Sat, 16 Feb 2008 13:22:11 +0200
parents 139f2f03b81b
children 44069f98343e
files src/plugins/fts-squat/squat-trie.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/fts-squat/squat-trie.c	Sat Feb 16 13:21:35 2008 +0200
+++ b/src/plugins/fts-squat/squat-trie.c	Sat Feb 16 13:22:11 2008 +0200
@@ -1800,10 +1800,10 @@
 	int ret;
 
 	max_chars = uni_utf8_strlen_n(data, size);
-	if (max_chars > ctx->trie->hdr.partial_len)
-		max_chars = partial_len;
+	i_assert(max_chars > 0);
 
-	for (i = 0, char_idx = 0; char_idx < max_chars; char_idx++) {
+	i = 0; char_idx = 0;
+	do {
 		bytelen = 0;
 		for (j = 0; j < partial_len && i+bytelen < size; j++)
 			bytelen += char_lengths[i + bytelen];
@@ -1825,9 +1825,9 @@
 			seq_range_array_remove_invert_range(ctx->maybe_uids,
 							    &ctx->tmp_uids2);
 		}
-
 		i += char_lengths[i];
-	}
+		char_idx++;
+	} while (max_chars - char_idx >= partial_len);
 	return 1;
 }