From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 03E881F910 for ; Mon, 31 Oct 2022 07:36:40 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AK0X8zfd"; dkim-atps=neutral Received: by mail-pg1-x536.google.com with SMTP id q71so9982211pgq.8 for ; Mon, 31 Oct 2022 00:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=O6sghLA46QGNxCLAzNBZ6r2LLUCC1VUjWRR0oxgsl70=; b=AK0X8zfdZC1XBFr0CAiWYrf+W/jTu7Y4rFvbHlqljZArbddwSs2NsJEpnmbZtkfn32 CDswRLFrq0kcDATWKnHIHKeYGyiW4F5/1lBd4qUPtSrFOrcSxp6KpXcAvDHURk5AhKSZ pNfsoY1K6yYQBjlE5x48busbuZ9JlQf0o2FSR+Sm8pPgygCmFlWTPGsZGoCfzDCOsSyl kXsBU5L3ITkijaDsflqUq8RngogyaP9jTPFTIO75U2mL2nqSZoPiiHo+iFkdWxpTi/dm aZoDaRKK3BjCptEDwZ22blUu4/C4TLZNKIkhtK1USJxl1iiYkipPy8hJIfLvFLsZFDWa NmqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=O6sghLA46QGNxCLAzNBZ6r2LLUCC1VUjWRR0oxgsl70=; b=q0p7bpfX4X9BtAnz8KvZz7eY0dR35/6YxV5bNKx4g1zvvZA8U+K1QyQSOXazZRdfax dyX7oG1nKM2OaHvzF1o17Wed+c53Y/6o05zTRQcrIUeVriVJJgffRWkDm3GvD1hZ+HOD /XUGEqh/tyaFH/4DXf2whp/nqGNETxU1+orjHaFFPdf6dt/e/6pAHnlm8/rC4/r0TDuY Zht4o+LnMiAuUyIMw7X55QhiyYjXsdlLBMcRCCoGMTC3x8ujQdNV6DFjpK35gAL5VSCm HsZcG4O0WznjrVGD2ansvOV4or4MJ69SzOenafVgnasvPgRw94pAcZlo3k5jxtXMGj1z wGhw== X-Gm-Message-State: ACrzQf0N07bd8/8ts7u6XmupY2SB+eeovqOmnzaN63vflWxHf/bnciUV hI9K5+49GZMEMsP4sGKBMIl6ztmx2t8= X-Google-Smtp-Source: AMsMyM5TGCcdaNeAizj0c+/lwFV0lrUstPUEVFAL2LSOV1Mo+ZyokCM2NXq0yOWbnZZeNLErD313mQ== X-Received: by 2002:a05:6a00:a21:b0:562:99d6:c30a with SMTP id p33-20020a056a000a2100b0056299d6c30amr12733089pfh.35.1667201799009; Mon, 31 Oct 2022 00:36:39 -0700 (PDT) Received: from Laptop-X1 ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id w13-20020a63f50d000000b0043a0de69c94sm3453924pgh.14.2022.10.31.00.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 00:36:38 -0700 (PDT) Date: Mon, 31 Oct 2022 15:36:35 +0800 From: Hangbin Liu To: Eric Wong Cc: meta@public-inbox.org Subject: Re: [Need Help] lei add quotes at the search Message-ID: References: <20221030051333.M329162@dcvr> <20221030230631.GB24949@dcvr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221030230631.GB24949@dcvr> List-Id: On Sun, Oct 30, 2022 at 11:06:31PM +0000, Eric Wong wrote: > Hangbin Liu wrote: > > Sorry, I don't have the fc35 environment now. > > No worries, I dont think fc35 is really a culprit. Were you > running a pre-release version of public-inbox or lei before? Sorry, I forgot. Maybe I installed via `dnf copr enable icon/b4` because I start using lei after reading blog https://people.kernel.org/monsieuricon/lore-lei-part-1-getting-started > > I'm curious about why the quote(%22) is added after "tc", not after "(" > > It's because Xapian can only handle a phrase after the `tc:' prefix. > thus: tc:"foo bar" actually parses `tc:' as a prefix for To/Cc; > while: "tc:foo bar" looks for the phrase "tc:foo bar" anywhere > in the message, and won't limit to To/Cc headers. > > This happens in the query_argv_to_string sub: > > https://public-inbox.org/meta/2feb3e13b49d222bc7bd28430a9cf159692a933f/s/?b=lib/PublicInbox/Search.pm#n358 > > From the CLI: lei q "tc:foo bar" is indistinguishable > from lei q tc:"foo bar" , so it gets treated as the latter. Thanks for the explanation. > > But if I have a long search line. This will breaks too much and hard to edit. > > e.g. My real previous search is like > > > > [lei] > > q = (tc:liuhangbin OR \ > > (dfn:drivers/net/wireguard/ AND rt:6.month.ago..) OR \ > > (dfn:tools/testing/selftests/net/ AND rt:1.month.ago..) OR \ > > (dfn:drivers/net/team/ AND rt:6.month.ago..) OR \ > > (dfn:net/ipv4/igmp.c AND rt:6.month.ago..) OR \ > > (dfn:net/ipv6/mcast.c AND rt:6.month.ago..)) \ > > NOT (tc:stable@vger.kernel.org OR f:sfr@canb.auug.org.au) > > > > If I add "\" on each "(", this will break to a very long config search. > > I tried to adjust it to > > I think that can work if lei.internal.rawstr is set in the > config to indicate stdin was used (It's auto-set by --stdin). > I guess it also works if it's the only lei.q config entry > and the lei.q entry contains "\n" > > cf. https://public-inbox.org/meta/20211110102837.41721-1-e@80x24.org/ > > > [lei] > > q = (tc:liuhangbin OR \ > > (dfn:drivers/net/wireguard/ AND rt:6.month.ago..) OR \ > > (dfn:tools/testing/selftests/net/ AND rt:1.month.ago..) OR \ > > (dfn:drivers/net/team/ AND rt:6.month.ago..) OR \ > > (dfn:net/ipv4/igmp.c AND rt:6.month.ago..) OR \ > > (dfn:net/ipv6/mcast.c AND rt:6.month.ago..)) > > q = NOT > > q = (tc:stable@vger.kernel.org > > q = OR > > q = f:sfr@canb.auug.org.au) > > > > And now it works... > > Sorta... at least for remotes it does: > > > $ lei up /home/Liu/Mail/gmail/Linux_Kernel > > # https://lore.kernel.org/all/ limiting to 2022-09-30 17:00 +0800 and newer > > 60927 lei_xsearch 0 wq_worker: query_one_mset: Exception: Unknown range operation at /usr/share/perl5/vendor_perl/PublicInbox/IPC.pm line 254. > > Note that Exception means it's not handling the first part of > the query when hitting the local Xapian DB. It's not doing the > approxidate ($X.month.ago) substitution for the local Xapian DB, > thus you got the "Unknown range operation". > > > # /usr/bin/curl -Sf -s -d '' https://lore.kernel.org/all/?x=m&t=1&q=((tc%3Aliuhangbin+OR+(dfn%3Adrivers%2Fnet%2Fwireguard%2F+AND+rt%3A6.month.ago..)+OR+(dfn%3Atools%2Ftesting%2Fselftests%2Fnet%2F+AND+rt%3A1.month.ago..)+OR+(dfn%3Adrivers%2Fnet%2Fteam%2F+AND+rt%3A6.month.ago..)+OR+(dfn%3Anet%2Fipv4%2Figmp.c+AND+rt%3A6.month.ago..)+OR+(dfn%3Anet%2Fipv6%2Fmcast.c+AND+rt%3A1651301673..))+NOT+(tc%3Astable%40vger.kernel.org+OR+f%3Asfr%40canb.auug.org.au))+AND+dt%3A20220930090001.. > > # https://lore.kernel.org/all/ 43/? > > Of course, the lack of approxidate parsing there inside lei is > fine, since the lore.kernel.org instance will do it remotely... > > > So I want to know when/why *lei* add the quotes. > > lei adds quotes since it can't distinguish if the shell user > used single or double quotes. Xapian uses double quotes for > phrase search, and I wanted: lei q "this is a phrase" > to work naturally, which means: lei q 'this is a phrase' > (with single quotes) works the same way as with double quotes > because the difference is handled by the shell and lei never > sees it. Thanks for the help. Hangbin