+ g_debug ("%s: searching folder %s.", __FUNCTION__, tny_folder_get_name (folder));
+
+ /* Check that we should be searching this folder. */
+ /* Note that we don't try to search sub-folders.
+ * Maybe we should, but that should be specified. */
+ if (helper->search->folder && strlen (helper->search->folder)) {
+ if (!strcmp (helper->search->folder, "outbox")) {
+ if (modest_tny_folder_guess_folder_type (folder) != TNY_FOLDER_TYPE_OUTBOX) {
+ modest_search_folder_get_headers_cb (folder, TRUE, NULL, NULL, helper);
+ return;
+ }
+ } else if (strcmp (tny_folder_get_id (folder), helper->search->folder) != 0) {
+ modest_search_folder_get_headers_cb (folder, TRUE, NULL, NULL, helper);
+ return;
+ }
+ }
+
+#ifdef MODEST_HAVE_OGS
+ if (helper->search->flags & MODEST_SEARCH_USE_OGS) {
+
+ if (helper->search->text_searcher == NULL && helper->search->query != NULL) {
+ OgsTextSearcher *text_searcher;