From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 28 03:11:40 2020 Received: (at 39258) by debbugs.gnu.org; 28 Feb 2020 08:11:40 +0000 Received: from localhost ([127.0.0.1]:60608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7akF-0005hH-Nt for submit@debbugs.gnu.org; Fri, 28 Feb 2020 03:11:39 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:35817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7akE-0005h2-2X for 39258@debbugs.gnu.org; Fri, 28 Feb 2020 03:11:38 -0500 X-Originating-IP: 92.169.129.147 Received: from bababa (lfbn-idf2-1-1315-147.w92-169.abo.wanadoo.fr [92.169.129.147]) (Authenticated sender: mail@ambrevar.xyz) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 9A4A120004; Fri, 28 Feb 2020 08:11:31 +0000 (UTC) From: Pierre Neidhardt To: Arun Isaac Subject: Re: [bug#39258] [PATCH 4/4] gnu: Use xapian index for package search. References: <20200227204150.30985-1-arunisaac@systemreboot.net> <20200227204150.30985-5-arunisaac@systemreboot.net> Date: Fri, 28 Feb 2020 09:11:31 +0100 In-Reply-To: <20200227204150.30985-5-arunisaac@systemreboot.net> (Arun Isaac's message of "Fri, 28 Feb 2020 02:11:50 +0530") Message-ID: <87h7zb5dxo.fsf@ambrevar.xyz> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 1.8 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Arun Isaac writes: > @@ -453, 6 +454, 20 @@ reducing the memory footprint." > > db-path) > > +(define (search-package-index profile querystring) Maybe `query-string'? Content analysis details: (1.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: tobias.gr] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.183.200 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: ambrevar.xyz (xyz)] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.70.183.200 listed in wl.mailspike.net] 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: 39258 Cc: ludo@gnu.org, 39258@debbugs.gnu.org, zimon.toutoune@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.8 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Arun Isaac writes: > @@ -453,6 +454,20 @@ reducing the memory footprint." > > db-path) > > +(define (search-package-index profile querystring) Maybe `query-string'? Content analysis details: (1.8 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: uzh.ch] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.183.200 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.70.183.200 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: ambrevar.xyz (xyz)] 1.0 BULK_RE_SUSP_NTLD Precedence bulk and RE: from a suspicious TLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Arun Isaac writes: > @@ -453,6 +454,20 @@ reducing the memory footprint." >=20=20 > db-path) >=20=20 > +(define (search-package-index profile querystring) Maybe `query-string'? > > --- a/guix/scripts/package.scm > +++ b/guix/scripts/package.scm > @@ -7,6 +7,7 @@ > ;;; Copyright =C2=A9 2016 Benz Schenk > ;;; Copyright =C2=A9 2016 Chris Marusich > ;;; Copyright =C2=A9 2019 Tobias Geerinckx-Rice > +;;; Copyright =C2=A9 2020 Arun Isaac > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -178,31 +179,40 @@ hooks\" run when building the profile." > ;;; Package specifications. > ;;; >=20=20 > -(define (find-packages-by-description regexps) > +(define (find-packages-by-description patterns) > "Return a list of pairs: packages whose name, synopsis, description, > or output matches at least one of REGEXPS sorted by relevance, and its > non-zero relevance score." Need to update the docstring. > - (let ((matches (fold-packages (lambda (package result) > - (if (package-superseded package) > - result > - (match (package-relevance package > - regexps) > - ((? zero?) > - result) > - (score > - (cons (cons package score) > - result))))) > - '()))) > - (sort matches > - (lambda (m1 m2) > - (match m1 > - ((package1 . score1) > - (match m2 > - ((package2 . score2) > - (if (=3D score1 score2) > - (string>? (package-full-name package1) > - (package-full-name package2)) > - (> score1 score2)))))))))) > + (define (regexp? str) > + (string-any > + (char-set #\. #\[ #\{ #\} #\( #\) #\\ #\* #\+ #\? #\| #\^ #\$) > + str)) > + > + (if (and (current-profile) > + (not (any regexp? patterns))) I would not put characters like ".", "$", or "+" here, lest we mistake a Xapian pattern for a regexp. As you said, I don't think both are compatible without ambiguity anyways, so we should probably drop regexp (or at least toggle them with a command line argument). =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl5YyzMACgkQm9z0l6S7 zH8myAf/dd2HZVdNaDmPZ/rEzf9eveD0wrhxS4pEwO8lJyBnobVHXfzcpDQ5ZjRx u/ZWqMIjbmjz8VFAPvQGMDIxQubxoDXii5ps94ZQNgitlhJfb4qq8REHC5rhuZHY bGxq4qTGKQYCXC3Yakg/uhRlQH4PhYvhVZDgWreJ2ay19JQV4fnfDeshdCq/oAUW IGti/XiBt50KWOBmRIctI3hYhEdA1mISQqh4RoPA9xKEQvnWSwS5hs1OZwcRCzGi mL3tgY7OKOmlojVVDCVo/r8Q9oXKlNiy+/sSilGCvO5AbsyFMsE3DqFYbQdFKpZq wFyI6XkXFHHmiKSVgYLct89Qc5Lgiw== =tOlQ -----END PGP SIGNATURE----- --=-=-=--