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 EEBF1431FAF for ; Tue, 20 Mar 2012 13:12:05 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 TfjdIjxXJI-g for ; Tue, 20 Mar 2012 13:12:05 -0700 (PDT) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 422F9431FAE for ; Tue, 20 Mar 2012 13:12:05 -0700 (PDT) Received: by werm13 with SMTP id m13so416476wer.26 for ; Tue, 20 Mar 2012 13:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=09K+GUwRn4P2+xpXIHtS4t8ui0oifHzdeRp+NuMC+rw=; b=QArwfiprLSgH9dqsybhqqDACMhZ2J9CaH4bNM5J+Clsc4I+aSbQx523Ow0KfgRjCL+ 2baZqLUEtFBONyf2zfU3ftq3+KuNuvxSDKIfJCbsWDwX2STQeZd2L7tFIEkwjMZTpLpQ RBILfzicx7vRGepnSXOvIFzpH8iPpesNZPshJQpfhHbs+I54aOlvFUuZ0k7CpMBkz4UN BfnaULrmCdcQA0Qa4Uf05oU4d9kJhM/a1ImR/735d7nTpShzEndPUSSdZuNMnxsM+9vi Edp1cRfu48kAS4/yIpVnEwLAmpxU2qiivAnITY7oDJs2YaH6HmpdEmpLchVX8Vd2mraM IMzA== Received: by 10.180.88.67 with SMTP id be3mr2678397wib.20.1332274323946; Tue, 20 Mar 2012 13:12:03 -0700 (PDT) Received: from localhost (94-192-233-223.zone6.bethere.co.uk. [94.192.233.223]) by mx.google.com with ESMTPS id gp8sm36537636wib.5.2012.03.20.13.12.01 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Mar 2012 13:12:02 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [WIP 0/2] Thread based searching Date: Tue, 20 Mar 2012 20:11:58 +0000 Message-Id: <1332274320-17487-1-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 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: Tue, 20 Mar 2012 20:12:06 -0000 This is very definitely only a work in progress but there have been several requests for this or something similar on irc. It implements a very crude form of thread based search: the user can ask for all the threads that have a message matching the primary query and have a (possibly different) message matching a secondary query. For example notmuch search --secondary-search from:A :AND: from:B returns all threads that have a message from A and a message from B. Similarly it allows the user to say "and not" on a thread based way. For example notmuch search --secondary-search from:A :AND_NOT: tag:mute returns all threads that have a message from A and no message with tag:mute. Anything allowing queries of this form is going to have to do some parsing of the query (rather than leaving this to xapian). To keep things as simple as possible this version only tries parsing of this form if passed --secondary-search and it assumes the last command line argument is the entire secondary search (so any complex secondary search should be independently quoted) and that the penultimate command line argument is either :AND: or :AND_NOT: for thread based "and" or thread based "and not" respectively. Finally, the two queries do play a different role even in the :AND: case. The threads returned are exactly those that match the primary query in (the order that would normally give) just filtered by containing a message matching the secondary query. Thus a search for query_a :AND query_b and a search for query_b :AND: query_a return threads in different orders, and one may be much faster than the other. At the moment this is purely lib and cli (ie no emacs interface). It is also not heavily tested and interactions with excludes or anything unusual could easily give strange results. Anyway I am just posting this in case anyone is interested. Best wishes Mark Mark Walters (2): lib: multithread cli: search: multithread lib/notmuch.h | 12 ++++++++++++ lib/query.cc | 46 +++++++++++++++++++++++++++++++++++++++++++++- notmuch-search.c | 19 +++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletions(-) -- 1.7.9.1