changeset 7246:599a9c679ee2 HEAD

squat_trie_lookup() for empty string returns now all UIDs from root node. This is mainly useful for debugging.
author Timo Sirainen <tss@iki.fi>
date Fri, 15 Feb 2008 14:04:06 +0200
parents dbb7f65e6307
children 17c65dfdac2a
files src/plugins/fts-squat/squat-trie.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/fts-squat/squat-trie.c	Fri Feb 15 13:25:47 2008 +0200
+++ b/src/plugins/fts-squat/squat-trie.c	Fri Feb 15 14:04:06 2008 +0200
@@ -1860,6 +1860,20 @@
 	array_clear(definite_uids);
 	array_clear(maybe_uids);
 
+	str_bytelen = strlen(str);
+	if (str_bytelen == 0) {
+		/* list all root UIDs */
+		i_array_init(&ctx.tmp_uids, 128);
+		ret = squat_uidlist_get_seqrange(trie->uidlist,
+						 trie->root.uid_list_idx,
+						 &ctx.tmp_uids);
+		squat_trie_filter_type(type, &ctx.tmp_uids,
+				       definite_uids);
+		squat_trie_add_unknown(trie, maybe_uids);
+		array_free(&ctx.tmp_uids);
+		return ret;
+	}
+
 	memset(&ctx, 0, sizeof(ctx));
 	ctx.trie = trie;
 	ctx.type = type;
@@ -1869,7 +1883,6 @@
 	i_array_init(&ctx.tmp_uids2, 128);
 	ctx.first = TRUE;
 
-	str_bytelen = strlen(str);
 	char_lengths = t_malloc0(str_bytelen);
 	for (i = 0, str_charlen = 0; i < str_bytelen; str_charlen++) {
 		bytes = uni_utf8_char_bytes(str[i]);