From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id D712F6DE0225 for ; Tue, 9 Oct 2018 22:53:53 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.226 X-Spam-Level: X-Spam-Status: No, score=-0.226 tagged_above=-999 required=5 tests=[AWL=-0.026, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ncf_3MksoKIZ for ; Tue, 9 Oct 2018 22:53:51 -0700 (PDT) Received: from jb55.com (jb55.com [45.79.91.128]) by arlo.cworth.org (Postfix) with ESMTPS id EEA7C6DE021E; Tue, 9 Oct 2018 22:53:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d= jb55.com; h=from:to:subject:date:message-id; s=default; bh=/L+ZMacAiehTs9BNTvvvso5jqPStWE5t8trdEXpTUMk=; b=ceMwD17gNKcP9vNUAWXZTpr88217MFpuPkCtisgk54d9PqEjhWLrVtkkcXCvNiFY1J8FkeHjUEd4BVjSlb9xIynj4YB9kgRPU6lN7lXXdkNewxz0UauChwNyiYE7xjU8Uk7P1fWaV5w0aNFs91CKGj/ZdXmZHEcJtnSLD770DYE0NYdAkGvPfPNUFZC/hwByq5peUXdv0EsmuZVjiXTpPYo5kX7qKV1S7jMM4twCoaCPfxUfSsCgVizDq5gDpI2WaNPxewz4u99tDJspmJfc7ljaZrt6JF/A9P61+bJmwbugKnFypo6jaitFupTmwsYhzIVPhlqgXnGYZg3wfJvheA== Received: from jb55.com (S010660e327dca171.vc.shawcable.net [24.84.152.187]) by jb55.com (OpenSMTPD) with ESMTPSA id a3dc166f TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Wed, 10 Oct 2018 05:53:49 +0000 (UTC) From: William Casarin To: notmuch@notmuchmail.org Subject: [PATCH RFC] index: add body: search query term Date: Tue, 9 Oct 2018 22:53:26 -0700 Message-Id: <20181010055326.19030-1-jb55@jb55.com> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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, 10 Oct 2018 05:53:54 -0000 This adds the ability to search specifically on the body eg. notmuch search tag:notmuch and body:PATCH Signed-off-by: William Casarin --- Hey there, I'm looking to add the ability to search specifically on the body. I was poking around in the indexer, added these lines and reindexed a few tags. It appears to work! I was just wondering if there's anything I'm missing? That seemed a bit too easy. I noticed there are some NOTMUCH_FIELDS that I'm not sure what they do. If anyone has any xapian knowledge that could shine some insight into what the next steps might be, if any. Thanks! Will lib/database.cc | 3 +++ lib/index.cc | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/database.cc b/lib/database.cc index 9cf8062c..0b085b21 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -297,6 +297,9 @@ prefix_t prefix_table[] = { { "subject", "XSUBJECT", NOTMUCH_FIELD_EXTERNAL | NOTMUCH_FIELD_PROBABILISTIC | NOTMUCH_FIELD_PROCESSOR}, + { "body", "XBODY", NOTMUCH_FIELD_EXTERNAL | + NOTMUCH_FIELD_PROBABILISTIC | + NOTMUCH_FIELD_PROCESSOR}, }; static void diff --git a/lib/index.cc b/lib/index.cc index 3f694387..299b8770 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -506,7 +506,7 @@ _index_mime_part (notmuch_message_t *message, body = (char *) g_byte_array_free (byte_array, false); if (body) { - _notmuch_message_gen_terms (message, NULL, body); + _notmuch_message_gen_terms (message, "body", body); free (body); } -- 2.19.0