From: Todd Date: Wed, 14 Jan 2015 00:00:26 +0000 (+1800) Subject: [PATCH v2 3/5] Add indexing for the mimetype term X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=415770b297bb11e47ae201c94cefdffc7a4550e0;p=notmuch-archives.git [PATCH v2 3/5] Add indexing for the mimetype term --- diff --git a/69/c2cd62998d4796f3ba2f44ab2baf8ce685e2f1 b/69/c2cd62998d4796f3ba2f44ab2baf8ce685e2f1 new file mode 100644 index 000000000..32b88719c --- /dev/null +++ b/69/c2cd62998d4796f3ba2f44ab2baf8ce685e2f1 @@ -0,0 +1,99 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 97E55431FDA + for ; Tue, 13 Jan 2015 16:01:06 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: 2.438 +X-Spam-Level: ** +X-Spam-Status: No, score=2.438 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id yV3ZFs1hAWEa for ; + Tue, 13 Jan 2015 16:01:04 -0800 (PST) +Received: from s75.web-hosting.com (s75.web-hosting.com [198.187.31.9]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B4164431FCF + for ; Tue, 13 Jan 2015 16:01:02 -0800 (PST) +Received: from user-69-73-37-128.knology.net ([69.73.37.128]:38910 + helo=localhost.localdomain) + by server75.web-hosting.com with esmtpsa (UNKNOWN:AES128-SHA256:128) + (Exim 4.82) (envelope-from ) + id 1YBBOQ-001yjE-0k; Tue, 13 Jan 2015 19:01:02 -0500 +From: Todd +To: notmuch@notmuchmail.org +Subject: [PATCH v2 3/5] Add indexing for the mimetype term +Date: Tue, 13 Jan 2015 18:00:26 -0600 +Message-Id: <1421193628-2699-4-git-send-email-todd@electricoding.com> +X-Mailer: git-send-email 1.9.1 +In-Reply-To: <1421193628-2699-1-git-send-email-todd@electricoding.com> +References: <1421193628-2699-1-git-send-email-todd@electricoding.com> +In-Reply-To: <8761ce7s16.fsf@nikula.org> +References: <8761ce7s16.fsf@nikula.org> +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - server75.web-hosting.com +X-AntiAbuse: Original Domain - notmuchmail.org +X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] +X-AntiAbuse: Sender Address Domain - electricoding.com +X-Get-Message-Sender-Via: server75.web-hosting.com: authenticated_id: + todd@electricoding.com +X-Source: +X-Source-Args: +X-Source-Dir: +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 14 Jan 2015 00:01:06 -0000 + +--- + lib/database.cc | 1 + + lib/index.cc | 6 ++++++ + 2 files changed, 7 insertions(+) + +diff --git a/lib/database.cc b/lib/database.cc +index 2de60f8..7c7a267 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -254,6 +254,7 @@ static prefix_t PROBABILISTIC_PREFIX[]= { + { "from", "XFROM" }, + { "to", "XTO" }, + { "attachment", "XATTACHMENT" }, ++ { "mimetype", "XMIMETYPE"}, + { "subject", "XSUBJECT"}, + }; + +diff --git a/lib/index.cc b/lib/index.cc +index 1a2e63d..2e27558 100644 +--- a/lib/index.cc ++++ b/lib/index.cc +@@ -318,6 +318,12 @@ _index_mime_part (notmuch_message_t *message, + return; + } + ++ ++ GMimeContentType* content_type = g_mime_object_get_content_type(part); ++ if (content_type) { ++ _notmuch_message_gen_terms (message, "mimetype", g_mime_content_type_to_string(content_type)); ++ } ++ + if (GMIME_IS_MULTIPART (part)) { + GMimeMultipart *multipart = GMIME_MULTIPART (part); + int i; +-- +1.9.1 +