Bug #671470 - Mail search on body doesn't work (local mail)
authorMilan Crha <mcrha@redhat.com>
Wed, 7 Mar 2012 10:07:18 +0000 (11:07 +0100)
committerMilan Crha <mcrha@redhat.com>
Wed, 7 Mar 2012 10:07:18 +0000 (11:07 +0100)
This contains also an interim "solution", till body indexing for
maildir folders is properly fixed.

camel/providers/local/camel-local-folder.c
camel/providers/local/camel-maildir-folder.c

index 10662aa..b62975a 100644 (file)
@@ -239,7 +239,10 @@ local_folder_search_by_expression (CamelFolder *folder,
                local_folder->search = camel_folder_search_new ();
 
        camel_folder_search_set_folder (local_folder->search, folder);
-       camel_folder_search_set_body_index (local_folder->search, local_folder->index);
+       if (camel_local_folder_get_index_body (local_folder))
+               camel_folder_search_set_body_index (local_folder->search, local_folder->index);
+       else
+               camel_folder_search_set_body_index (local_folder->search, NULL);
        matches = camel_folder_search_search (local_folder->search, expression, NULL, error);
 
        CAMEL_LOCAL_FOLDER_UNLOCK (folder, search_lock);
@@ -265,7 +268,10 @@ local_folder_search_by_uids (CamelFolder *folder,
                local_folder->search = camel_folder_search_new ();
 
        camel_folder_search_set_folder (local_folder->search, folder);
-       camel_folder_search_set_body_index (local_folder->search, local_folder->index);
+       if (camel_local_folder_get_index_body (local_folder))
+               camel_folder_search_set_body_index (local_folder->search, local_folder->index);
+       else
+               camel_folder_search_set_body_index (local_folder->search, NULL);
        matches = camel_folder_search_search (local_folder->search, expression, uids, error);
 
        CAMEL_LOCAL_FOLDER_UNLOCK (folder, search_lock);
@@ -345,7 +351,10 @@ local_folder_count_by_expression (CamelFolder *folder,
                local_folder->search = camel_folder_search_new ();
 
        camel_folder_search_set_folder (local_folder->search, folder);
-       camel_folder_search_set_body_index (local_folder->search, local_folder->index);
+       if (camel_local_folder_get_index_body (local_folder))
+               camel_folder_search_set_body_index (local_folder->search, local_folder->index);
+       else
+               camel_folder_search_set_body_index (local_folder->search, NULL);
        matches = camel_folder_search_count (local_folder->search, expression, error);
 
        CAMEL_LOCAL_FOLDER_UNLOCK (folder, search_lock);
index dcb0887..9f79fb9 100644 (file)
@@ -474,8 +474,10 @@ camel_maildir_folder_new (CamelStore *parent_store,
 
        folder = g_object_new (
                CAMEL_TYPE_MAILDIR_FOLDER,
-               "display-name", basename, "full-name", full_name,
-               "parent-store", parent_store, NULL);
+               "display-name", basename,
+               "full-name", full_name,
+               "parent-store", parent_store,
+               NULL);
 
        service = CAMEL_SERVICE (parent_store);
        settings = camel_service_get_settings (service);
@@ -491,6 +493,9 @@ camel_maildir_folder_new (CamelStore *parent_store,
 
        g_free (basename);
 
+       /* indexing doesn't work with maildir properly, thus disable it */
+       g_object_set (folder, "index-body", FALSE, NULL);
+
        return folder;
 }