From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:40634) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7adr-0001FV-I6 for guix-patches@gnu.org; Fri, 28 Feb 2020 03:05:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7adq-0000AO-HC for guix-patches@gnu.org; Fri, 28 Feb 2020 03:05:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54623) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j7adq-0000AG-Ee for guix-patches@gnu.org; Fri, 28 Feb 2020 03:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j7adq-0005W9-9n for guix-patches@gnu.org; Fri, 28 Feb 2020 03:05:02 -0500 Subject: [bug#39258] [PATCH 3/4] gnu: Generate xapian package search index. Resent-Message-ID: From: Pierre Neidhardt References: <20200227204150.30985-1-arunisaac@systemreboot.net> <20200227204150.30985-4-arunisaac@systemreboot.net> Date: Fri, 28 Feb 2020 09:04:39 +0100 In-Reply-To: <20200227204150.30985-4-arunisaac@systemreboot.net> (Arun Isaac's message of "Fri, 28 Feb 2020 02:11:49 +0530") Message-ID: <87k1475e94.fsf@ambrevar.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Arun Isaac Cc: ludo@gnu.org, 39258@debbugs.gnu.org, zimon.toutoune@gmail.com --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Arun Isaac writes: > +(define (generate-package-search-index directory) > + "Generate under DIRECTORY a xapian index of all the available packages= ." > + (define db-path > + (string-append directory %package-search-index)) > + > + (mkdir-p (dirname db-path)) > + (call-with-writable-database db-path > + (lambda (db) > + (fold-packages (lambda (package _) > + (let* ((idterm (string-append "Q" (package-name p= ackage))) > + (doc (make-document #:data (package-name p= ackage) > + #:terms `((,idterm . 0= )))) > + (term-generator (make-term-generator #:ste= m (make-stem "en") > + #:doc= ument doc))) > + (index-text! term-generator (package-descriptio= n package)) > + (replace-document! db idterm doc))) I guess these non-functional functions (index-text!, replace-document!) represent how Xapian works at the C++ level. Would it be possible to make more functional bindings nonetheless? =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl5YyZcACgkQm9z0l6S7 zH9EkAf/eCddrqNRJXNrLpUYJ2kOAuqshemvMAF4v0WSF3enTf7Y59qDF56FS9V7 SsvxrUL9CF1LzJAquLLSNUnTEDLcmLb1p6O/ksSq0ZMQ9Yr4MGBeLJU36m1+WGv3 n+03tUCFvSLDupAlyBxNxCX4QBmzGd79shu3X5NZLVp06G842chKFB6GXlQyFRhh iJLDq1kynhsW6eZIPONvHqQxTzEfb8Wh5wbNbzPvvN8fIWKPoBpP5yxXHLDGC2vM VcodopQOoXebt1XAh4WIz4Tr3KaF3/B5m9OunrdLmLj3ETZQwTbifkObhnPG7tOp NI1rOx5CP47ckZtbdK9HnfvSkvO0Tw== =UV3T -----END PGP SIGNATURE----- --=-=-=--