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 F409E6DE16D1 for ; Sat, 25 Mar 2017 04:30:03 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.005 X-Spam-Level: X-Spam-Status: No, score=-0.005 tagged_above=-999 required=5 tests=[AWL=0.006, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] 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 bT6Q45d_X7hk for ; Sat, 25 Mar 2017 04:30:03 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 4D99C6DE16CC for ; Sat, 25 Mar 2017 04:30:03 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1crjsk-0005AS-WB for notmuch@notmuchmail.org; Sat, 25 Mar 2017 07:29:19 -0400 Received: (nullmailer pid 21074 invoked by uid 1000); Sat, 25 Mar 2017 11:30:00 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] lib: handle empty string in regexp field processors In-Reply-To: <20170324225251.21107-3-david@tethera.net> References: <20170324225251.21107-1-david@tethera.net> <20170324225251.21107-3-david@tethera.net> Date: Sat, 25 Mar 2017 08:30:00 -0300 Message-ID: <87vaqxiog7.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Sat, 25 Mar 2017 11:30:04 -0000 David Bremner writes: > + if (str.size () == 0) > + return Xapian::Query(Xapian::Query::OP_AND_NOT, > + Xapian::Query::MatchAll, > + Xapian::Query (Xapian::Query::OP_WILDCARD, term_prefix)); > + Full disclosure, this is a pretty expensive query. On an older i7, it takes about 7.5s (elapsed) on my 466k messages to find 702 messages without a subject. I don't think it's a big deal, since I don't think notmuch search 'subject:""' is likely to be typed by mistake. For comparison, "grep -R '^Subject:$'" (which is not exactly the same query, since some messages completely lack a Subject: line). takes about 390s (elapsed).