Subject: Re: [bug#39258] [PATCH 3/4] gnu: Generate xapian package search index.

From: Pierre Neidhardt <[email-masked]>
Date: Fri, 28 Feb 2020 09:04:39 +0100

Arun Isaac <[email-masked]> 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 package)))
> +                              (doc (make-document #:data (package-name package)
> +                                                  #:terms `((,idterm . 0))))
> +                              (term-generator (make-term-generator #:stem (make-stem "en")
> +                                                                   #:document doc)))
> +                         (index-text! term-generator (package-description 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?

-- 
Pierre Neidhardt
https://ambrevar.xyz/