1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
3 ;;; Copyright © 2015, 2016 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
5 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2018, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
8 ;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages search)
26 #:use-module ((guix licenses)
27 #:select (gpl2 gpl2+ gpl3+ lgpl2.1+ bsd-3 x11 perl-license))
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module (guix utils)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system perl)
34 #:use-module (guix build-system python)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages databases)
39 #:use-module (gnu packages freedesktop)
40 #:use-module (gnu packages less)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages pcre)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages pdf)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages python-web)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages sphinx)
49 #:use-module (gnu packages web)
50 #:use-module (gnu packages xdisorg)
51 #:use-module (gnu packages xml))
57 ;; Note: When updating Xapian, remember to update xapian-bindings below.
60 (uri (string-append "https://oligarchy.co.uk/xapian/" version
61 "/xapian-core-" version ".tar.xz"))
63 (base32 "0xsb4ihf3p767f0zx9p4janwni6r9sg5j6lry0002i8hmnsdnv8r"))))
64 (build-system gnu-build-system)
65 (inputs `(("zlib" ,zlib)
66 ("util-linux" ,util-linux "lib")))
69 (modify-phases %standard-phases
71 ;; As of Xapian 1.3.3, the TCP server implementation uses
72 ;; getaddrinfo(). This does not work in the build environment,
73 ;; so exclude those tests. See HACKING for the list of targets.
82 (synopsis "Search Engine Library")
84 "Xapian is a highly adaptable toolkit which allows developers to easily
85 add advanced indexing and search facilities to their own applications. It
86 supports the Probabilistic Information Retrieval model and also supports a
87 rich set of boolean query operators.")
88 (home-page "https://xapian.org/")
89 (license (list gpl2+ bsd-3 x11))))
91 (define-public python-xapian-bindings
92 (package (inherit xapian)
93 (name "python-xapian-bindings")
94 (version (package-version xapian))
97 (uri (string-append "https://oligarchy.co.uk/xapian/" version
98 "/xapian-bindings-" version ".tar.xz"))
101 "13ziql8027glgihgvnbsa75vkcn82g83mbihj60zf0njj170clpy"))))
102 (build-system gnu-build-system)
104 `(#:configure-flags '("--with-python3")
106 (list (string-append "pkgpylibdir="
107 (assoc-ref %outputs "out")
108 "/lib/python" ,(version-major+minor
109 (package-version python))
110 "/site-packages/xapian"))))
112 `(("python-sphinx" ,python-sphinx))) ;for documentation
117 (synopsis "Python bindings for the Xapian search engine library")
120 (define-public perl-search-xapian
122 (name "perl-search-xapian")
127 (uri (string-append "mirror://cpan/authors/id/O/OL/OLLY/"
128 "Search-Xapian-" version ".tar.gz"))
130 (base32 "1pbl8pbgmbs3i8yik4p63g4pd9bhn0dp3d7l667dkvw0kccl66c7"))))
131 (build-system perl-build-system)
133 `(("perl-devel-leak" ,perl-devel-leak)))
135 `(("xapian" ,xapian)))
136 (home-page "https://metacpan.org/release/Search-Xapian")
137 (synopsis "Perl XS frontend to the Xapian C++ search library")
139 "Search::Xapian wraps most methods of most Xapian classes. The missing
140 classes and methods should be added in the future. It also provides a
141 simplified, more 'perlish' interface to some common operations.")
142 (license perl-license)))
144 (define-public libtocc
151 (uri (string-append "https://github.com/aidin36/tocc/releases/download/"
152 "v" version "/tocc-" version ".tar.gz"))
155 "1kd2jd74m8ksc8s7hh0haz0q0c3n0mr39bbky262kk4l58f1g068"))))
156 (build-system gnu-build-system)
157 (native-inputs `(("catch" ,catch-framework)))
158 (inputs `(("unqlite" ,unqlite)))
160 `(#:phases (modify-phases %standard-phases
161 (add-before 'configure 'chdir-source
163 (chdir "libtocc/src")
167 (with-directory-excursion "../tests"
168 (invoke "./configure"
169 (string-append "CONFIG_SHELL="
171 (string-append "SHELL="
175 "LDFLAGS=-L../src/.libs "
176 "-Wl,-rpath=../src/.libs"))
178 (invoke "./libtocctests")))))))
179 (home-page "https://t-o-c-c.com/")
180 (synopsis "Tool for Obsessive Compulsive Classifiers")
182 "libtocc is the engine of the Tocc project, a tag-based file management
183 system. The goal of Tocc is to provide a better system for classifying files
184 that is more flexible than classic file systems that are based on a tree of
185 files and directories.")
191 (version (package-version libtocc))
192 (source (package-source libtocc))
193 (build-system gnu-build-system)
195 `(("libtocc" ,libtocc)
196 ("unqlite" ,unqlite)))
198 `(#:tests? #f ;No tests
199 #:phases (modify-phases %standard-phases
201 'unpack 'chdir-source
202 (lambda _ (chdir "cli/src"))))))
203 (home-page "https://t-o-c-c.com/")
204 (synopsis "Command-line interface to libtocc")
206 "Tocc is a tag-based file management system. This package contains the
207 command line tool for interacting with libtocc.")
217 (uri (string-append "mirror://gnu/bool/bool-"
221 "1frdmgrmb509fxbdpsxxw3lvvwv7xm1pavqrqgm4jg698iix6xfw"))))
222 (build-system gnu-build-system)
223 (home-page "https://www.gnu.org/software/bool/")
224 (synopsis "Finding text and HTML files that match boolean expressions")
226 "GNU Bool is a utility to perform text searches on files using Boolean
227 expressions. For example, a search for \"hello AND world\" would return a
228 file containing the phrase \"Hello, world!\". It supports both AND and OR
229 statements, as well as the NEAR statement to search for the occurrence of
230 words in close proximity to each other. It handles context gracefully,
231 accounting for new lines and paragraph changes. It also has robust support
232 for parsing HTML files.")
235 (define-public hyperestraier
237 (name "hyperestraier")
242 (uri (string-append "http://fallabs.com/" name "/"
243 name "-" version ".tar.gz"))
246 "1qk3pxgzyrpcz5qfyd5xs2hw9q1cbb7j5zd4kp1diq501wcj2vs9"))))
250 (build-system gnu-build-system)
252 `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
253 (assoc-ref %outputs "out")
255 (home-page "https://fallabs.com/hyperestraier")
256 (synopsis "Full-text search system")
257 (description "Hyper Estraier can be used to integrate full-text
258 search into applications, using either the provided command line and CGI
259 interfaces, or a C API.")
262 (define-public mlocate
268 (uri (string-append "http://releases.pagure.org/mlocate/"
269 "mlocate-" version ".tar.xz"))
272 "0gi6y52gkakhhlnzy0p6izc36nqhyfx5830qirhvk3qrzrwxyqrh"))))
273 (build-system gnu-build-system)
274 (home-page "https://pagure.io/mlocate")
275 (synopsis "Locate files on the file system")
277 "mlocate is a locate/updatedb implementation. The @code{m} stands for
278 \"merging\": @code{updatedb} reuses the existing database to avoid rereading
279 most of the file system, which makes it faster and does not trash the system
280 caches as much. The locate(1) utility is intended to be completely compatible
281 with slocate, and attempts to be compatible to GNU locate when it does not
282 conflict with slocate compatibility.")
285 (define-public swish-e
291 (uri (list (string-append
292 "https://web.archive.org/web/20160730145202/"
293 "http://swish-e.org/distribution/"
294 "swish-e-" version ".tar.gz")
295 (string-append "http://http.debian.net/debian/pool/"
296 "main/s/swish-e/swish-e_" version
298 (file-name (string-append name "-" version ".tar.gz"))
301 "0qkrk7z25yp9hynj21vxkyn7yi8gcagcfxnass5cgczcz0gm9pax"))
302 (patches (search-patches "swish-e-search.patch"
303 "swish-e-format-security.patch"))))
304 (build-system gnu-build-system)
305 ;; Several other packages and perl modules may be installed alongside
306 ;; swish-e to extend its features at runtime, but are not required for
307 ;; building: xpdf, catdoc, MP3::Tag, Spreadsheet::ParseExcel,
311 ("perl-uri" ,perl-uri)
312 ("perl-html-parser" ,perl-html-parser)
313 ("perl-html-tagset" ,perl-html-tagset)
314 ("perl-mime-types" ,perl-mime-types)))
316 `(;; XXX: This fails to build with zlib (API mismatch) and tests fail
317 ;; with libxml2, so disable both.
318 #:configure-flags (list (string-append "--without-zlib")
319 (string-append "--without-libxml2"))
320 #:phases (modify-phases %standard-phases
321 (add-after 'install 'wrap-programs
322 (lambda* (#:key inputs outputs #:allow-other-keys)
323 (let* ((out (assoc-ref outputs "out")))
326 (wrap-program program
327 `("PERL5LIB" ":" prefix
329 (string-append (assoc-ref inputs i)
330 "/lib/perl5/site_perl"))
331 ;; These perl modules have no propagated
332 ;; inputs, so no further analysis needed.
336 "perl-mime-types")))))
337 (list (string-append out "/lib/swish-e/swishspider")
338 (string-append out "/bin/swish-filter-test")))
340 (home-page (string-append "https://web.archive.org/web/20160730145202/"
341 "http://swish-e.org"))
342 (synopsis "Web indexing system")
344 "Swish-e is Simple Web Indexing System for Humans - Enhanced. Swish-e
345 can quickly and easily index directories of files or remote web sites and
346 search the generated indexes.")
347 (license gpl2+))) ;with exception
349 (define-public xapers
357 "https://finestructure.net/xapers/releases/xapers-"
361 "0ykz6hn3qj46w3c99d6q0pi5ncq2894simcl7vapv047zm3cylmd"))))
362 (build-system python-build-system)
364 `(("poppler" ,poppler)
365 ("python-urwid" ,python-urwid)
367 ("xdg-utils" ,xdg-utils)))
369 `(("python-latexcodec" ,python-latexcodec)
370 ("python-pybtex" ,python-pybtex)
371 ("python-pycurl" ,python-pycurl)
372 ("python-pyyaml" ,python-pyyaml)
373 ("python-six" ,python-six)
374 ("python-xapian-bindings" ,python-xapian-bindings)))
376 `(#:modules ((ice-9 rdelim)
377 (guix build python-build-system)
380 (modify-phases %standard-phases
381 (add-after 'install 'install-doc
382 (lambda* (#:key inputs outputs #:allow-other-keys)
383 (define (purge-term-support input output)
384 (let loop ((line (read-line input)))
385 (if (string-prefix? "if [[ \"$term\"" line)
386 (begin (display "eval \"$cmd\"\n" output)
388 (begin (display (string-append line "\n") output)
389 (loop (read-line input))))))
390 (let* ((out (assoc-ref outputs "out"))
391 (bin (string-append out "/bin"))
392 (adder-out (string-append bin "/xapers-adder"))
393 (man1 (string-append out "/share/man/man1")))
394 (install-file "man/man1/xapers.1" man1)
395 (install-file "man/man1/xapers-adder.1" man1)
396 ;; below is equivalent to setting --no-term option
397 ;; permanently on; this is desirable to avoid imposing
398 ;; an x-terminal installation on the user but breaks
399 ;; some potential xapers-adder uses like auto browser
400 ;; pdf handler, but user could instead still use
401 ;; e.g. "xterm -e xapers-adder %F" for same use.
402 ;; alternatively we could propagate xterm as an input
403 ;; and replace 'x-terminal-emulator' with 'xterm'
404 (call-with-input-file "bin/xapers-adder"
406 (call-with-output-file adder-out
408 (purge-term-support input output)))))
409 (chmod adder-out #o555)))))))
410 (home-page "https://finestructure.net/xapers/")
411 (synopsis "Personal document indexing system")
413 "Xapers is a personal document indexing system,
414 geared towards academic journal articles build on the Xapian search engine.
415 Think of it as your own personal document search engine, or a local cache of
416 online libraries. It provides fast search of document text and
417 bibliographic data and simple document and bibtex retrieval.")
427 (url "https://github.com/Genivia/ugrep")
428 (commit (string-append "v" version))))
430 (base32 "1g3sxnrcaz1jxwa8nwrxpr63g4y0ha5zcf10053ciy9wjh6wqs1w"))
431 (file-name (string-append name "-" version "-checkout"))
432 (modules '((guix build utils)))
435 (delete-file-recursively "bin") ;; pre-build executables
436 (for-each delete-file (find-files "tests" "^archive\\..*"))
437 (for-each delete-file (find-files "tests" "^.*\\.pdf$"))
438 (for-each delete-file (find-files "tests" "^.*\\.class$"))
440 (build-system gnu-build-system)
445 ("lzip" ,lzip) ;; lzma
449 `(#:tests? #f ; no way to rebuild the binary input files
452 (modify-phases %standard-phases
453 (add-before 'check 'check-setup
455 ;; Unpatch shebangs in tests.
456 (substitute* '("tests/Hello.bat"
458 (("#!/gnu/store/.*/bin/sh") "#!/bin/sh")))))))
459 (home-page "https://github.com/Genivia/ugrep/")
460 (synopsis "Faster grep with an interactive query UI")
461 (description "Ugrep is a ultra fast searcher of file systems, text
462 and binary files, source code, archives, compressed files, documents, and
465 While still being compatible with the standard GNU/BSD grep command-line
466 options, ugrep supports fuzzy search as well as structured and (adjustable)
467 colored output, piped through \"less\" for pagination. An interactive query
468 UI allows refinement and has a built-in help (press F1). Ugrep implements
469 multi-threaded and other techniques to speed up search, pattern-matching and
470 decompression. Many pre-defined regexps ease searching e.g. C typdefs or XML
471 attributes. Results can be output in several structured or self-defined
475 ;;; search.scm ends here