changeset 6486:33480577814e HEAD

Merge also unnecessary sub-ORs.
author Timo Sirainen <tss@iki.fi>
date Sun, 23 Sep 2007 14:21:53 +0300
parents 2eff72b212fe
children fda4b611440b
files src/lib-storage/index/index-search.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-search.c	Sun Sep 23 14:16:10 2007 +0300
+++ b/src/lib-storage/index/index-search.c	Sun Sep 23 14:21:53 2007 +0300
@@ -823,8 +823,10 @@
 				sub->not = !sub->not;
 		}
 
-		if (args->type == SEARCH_SUB && parent_and) {
-			/* p and (q and ..) == p and q and .. */
+		if ((args->type == SEARCH_SUB && parent_and) ||
+		    (args->type == SEARCH_OR && !parent_and)) {
+			/* p and (q and ..) == p and q and ..
+			   p or (q or ..) == p or q or .. */
 			sub = args->value.subargs;
 			for (; sub->next != NULL; sub = sub->next) ;
 			sub->next = args->next;