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 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages search)
25 #:use-module ((guix licenses)
26 #:select (gpl2 gpl2+ gpl3+ lgpl2.1+ bsd-3 x11 perl-license))
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system perl)
32 #:use-module (guix build-system python)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages check)
36 #:use-module (gnu packages databases)
37 #:use-module (gnu packages freedesktop)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages perl)
40 #:use-module (gnu packages pdf)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages python-web)
43 #:use-module (gnu packages python-xyz)
44 #:use-module (gnu packages sphinx)
45 #:use-module (gnu packages web)
46 #:use-module (gnu packages xdisorg)
47 #:use-module (gnu packages xml))
53 ;; Note: When updating Xapian, remember to update xapian-bindings below.
56 (uri (string-append "https://oligarchy.co.uk/xapian/" version
57 "/xapian-core-" version ".tar.xz"))
59 (base32 "0ja95vn0lkf6qkjhg2blkx306i10hg4fr8wlrhalmly93307lnlp"))))
60 (build-system gnu-build-system)
61 (inputs `(("zlib" ,zlib)
62 ("util-linux" ,util-linux)))
65 (modify-phases %standard-phases
67 ;; As of Xapian 1.3.3, the TCP server implementation uses
68 ;; getaddrinfo(). This does not work in the build environment,
69 ;; so exclude those tests. See HACKING for the list of targets.
78 (synopsis "Search Engine Library")
80 "Xapian is a highly adaptable toolkit which allows developers to easily
81 add advanced indexing and search facilities to their own applications. It
82 supports the Probabilistic Information Retrieval model and also supports a
83 rich set of boolean query operators.")
84 (home-page "https://xapian.org/")
85 (license (list gpl2+ bsd-3 x11))))
87 (define-public python-xapian-bindings
88 (package (inherit xapian)
89 (name "python-xapian-bindings")
90 (version (package-version xapian))
93 (uri (string-append "https://oligarchy.co.uk/xapian/" version
94 "/xapian-bindings-" version ".tar.xz"))
97 "0qb17cw8n0g5gcg8dq5b3hs6i16w74rgxcryd0ja9n2h0rlda2an"))))
98 (build-system gnu-build-system)
100 `(#:configure-flags '("--with-python3")
102 (list (string-append "pkgpylibdir="
103 (assoc-ref %outputs "out")
104 "/lib/python" ,(version-major+minor
105 (package-version python))
106 "/site-packages/xapian"))))
108 `(("python-sphinx" ,python-sphinx))) ;for documentation
113 (synopsis "Python bindings for the Xapian search engine library")
116 (define-public perl-search-xapian
118 (name "perl-search-xapian")
123 (uri (string-append "mirror://cpan/authors/id/O/OL/OLLY/"
124 "Search-Xapian-" version ".tar.gz"))
127 "0hpa8gi38j0ibq8af6dy69lm1bl5jnq76nsa69dbrzbr88l5m594"))))
128 (build-system perl-build-system)
130 `(("perl-devel-leak" ,perl-devel-leak)))
132 `(("xapian" ,xapian)))
133 (home-page "https://metacpan.org/release/Search-Xapian")
134 (synopsis "Perl XS frontend to the Xapian C++ search library")
136 "Search::Xapian wraps most methods of most Xapian classes. The missing
137 classes and methods should be added in the future. It also provides a
138 simplified, more 'perlish' interface to some common operations.")
139 (license perl-license)))
141 (define-public libtocc
148 (uri (string-append "https://github.com/aidin36/tocc/releases/download/"
149 "v" version "/tocc-" version ".tar.gz"))
152 "1kd2jd74m8ksc8s7hh0haz0q0c3n0mr39bbky262kk4l58f1g068"))))
153 (build-system gnu-build-system)
154 (native-inputs `(("catch" ,catch-framework)))
155 (inputs `(("unqlite" ,unqlite)))
157 `(#:phases (modify-phases %standard-phases
158 (add-before 'configure 'chdir-source
160 (chdir "libtocc/src")
164 (with-directory-excursion "../tests"
165 (invoke "./configure"
166 (string-append "CONFIG_SHELL="
168 (string-append "SHELL="
172 "LDFLAGS=-L../src/.libs "
173 "-Wl,-rpath=../src/.libs"))
175 (invoke "./libtocctests")))))))
176 (home-page "https://t-o-c-c.com/")
177 (synopsis "Tool for Obsessive Compulsive Classifiers")
179 "libtocc is the engine of the Tocc project, a tag-based file management
180 system. The goal of Tocc is to provide a better system for classifying files
181 that is more flexible than classic file systems that are based on a tree of
182 files and directories.")
188 (version (package-version libtocc))
189 (source (package-source libtocc))
190 (build-system gnu-build-system)
192 `(("libtocc" ,libtocc)
193 ("unqlite" ,unqlite)))
195 `(#:tests? #f ;No tests
196 #:phases (modify-phases %standard-phases
198 'unpack 'chdir-source
199 (lambda _ (chdir "cli/src"))))))
200 (home-page "https://t-o-c-c.com/")
201 (synopsis "Command-line interface to libtocc")
203 "Tocc is a tag-based file management system. This package contains the
204 command line tool for interacting with libtocc.")
214 (uri (string-append "mirror://gnu/bool/bool-"
218 "1frdmgrmb509fxbdpsxxw3lvvwv7xm1pavqrqgm4jg698iix6xfw"))))
219 (build-system gnu-build-system)
220 (home-page "https://www.gnu.org/software/bool/")
221 (synopsis "Finding text and HTML files that match boolean expressions")
223 "GNU Bool is a utility to perform text searches on files using Boolean
224 expressions. For example, a search for \"hello AND world\" would return a
225 file containing the phrase \"Hello, world!\". It supports both AND and OR
226 statements, as well as the NEAR statement to search for the occurrence of
227 words in close proximity to each other. It handles context gracefully,
228 accounting for new lines and paragraph changes. It also has robust support
229 for parsing HTML files.")
232 (define-public hyperestraier
234 (name "hyperestraier")
239 (uri (string-append "http://fallabs.com/" name "/"
240 name "-" version ".tar.gz"))
243 "1qk3pxgzyrpcz5qfyd5xs2hw9q1cbb7j5zd4kp1diq501wcj2vs9"))))
247 (build-system gnu-build-system)
249 `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
250 (assoc-ref %outputs "out")
252 (home-page "http://fallabs.com/hyperestraier")
253 (synopsis "Full-text search system")
254 (description "Hyper Estraier can be used to integrate full-text
255 search into applications, using either the provided command line and CGI
256 interfaces, or a C API.")
259 (define-public mlocate
265 (uri (string-append "http://releases.pagure.org/mlocate/"
266 "mlocate-" version ".tar.xz"))
269 "0gi6y52gkakhhlnzy0p6izc36nqhyfx5830qirhvk3qrzrwxyqrh"))))
270 (build-system gnu-build-system)
271 (home-page "https://pagure.io/mlocate")
272 (synopsis "Locate files on the file system")
274 "mlocate is a locate/updatedb implementation. The @code{m} stands for
275 \"merging\": @code{updatedb} reuses the existing database to avoid rereading
276 most of the file system, which makes it faster and does not trash the system
277 caches as much. The locate(1) utility is intended to be completely compatible
278 with slocate, and attempts to be compatible to GNU locate when it does not
279 conflict with slocate compatibility.")
282 (define-public swish-e
288 (uri (list (string-append
289 "https://web.archive.org/web/20160730145202/"
290 "http://swish-e.org/distribution/"
291 "swish-e-" version ".tar.gz")
292 (string-append "http://http.debian.net/debian/pool/"
293 "main/s/swish-e/swish-e_" version
295 (file-name (string-append name "-" version ".tar.gz"))
298 "0qkrk7z25yp9hynj21vxkyn7yi8gcagcfxnass5cgczcz0gm9pax"))
299 (patches (search-patches "swish-e-search.patch"
300 "swish-e-format-security.patch"))))
301 (build-system gnu-build-system)
302 ;; Several other packages and perl modules may be installed alongside
303 ;; swish-e to extend its features at runtime, but are not required for
304 ;; building: xpdf, catdoc, MP3::Tag, Spreadsheet::ParseExcel,
308 ("perl-uri" ,perl-uri)
309 ("perl-html-parser" ,perl-html-parser)
310 ("perl-html-tagset" ,perl-html-tagset)
311 ("perl-mime-types" ,perl-mime-types)))
313 `(;; XXX: This fails to build with zlib (API mismatch) and tests fail
314 ;; with libxml2, so disable both.
315 #:configure-flags (list (string-append "--without-zlib")
316 (string-append "--without-libxml2"))
317 #:phases (modify-phases %standard-phases
318 (add-after 'install 'wrap-programs
319 (lambda* (#:key inputs outputs #:allow-other-keys)
320 (let* ((out (assoc-ref outputs "out")))
323 (wrap-program program
324 `("PERL5LIB" ":" prefix
326 (string-append (assoc-ref inputs i)
327 "/lib/perl5/site_perl"))
328 ;; These perl modules have no propagated
329 ;; inputs, so no further analysis needed.
333 "perl-mime-types")))))
334 (list (string-append out "/lib/swish-e/swishspider")
335 (string-append out "/bin/swish-filter-test")))
337 (home-page (string-append "https://web.archive.org/web/20160730145202/"
338 "http://swish-e.org"))
339 (synopsis "Web indexing system")
341 "Swish-e is Simple Web Indexing System for Humans - Enhanced. Swish-e
342 can quickly and easily index directories of files or remote web sites and
343 search the generated indexes.")
344 (license gpl2+))) ;with exception
346 (define-public xapers
354 "https://finestructure.net/xapers/releases/xapers-"
358 "0ykz6hn3qj46w3c99d6q0pi5ncq2894simcl7vapv047zm3cylmd"))))
359 (build-system python-build-system)
361 `(("poppler" ,poppler)
362 ("python-urwid" ,python-urwid)
364 ("xdg-utils" ,xdg-utils)))
366 `(("python-latexcodec" ,python-latexcodec)
367 ("python-pybtex" ,python-pybtex)
368 ("python-pycurl" ,python-pycurl)
369 ("python-pyyaml" ,python-pyyaml)
370 ("python-six" ,python-six)
371 ("python-xapian-bindings" ,python-xapian-bindings)))
373 `(#:modules ((ice-9 rdelim)
374 (guix build python-build-system)
377 (modify-phases %standard-phases
378 (add-after 'install 'install-doc
379 (lambda* (#:key inputs outputs #:allow-other-keys)
380 (define (purge-term-support input output)
381 (let loop ((line (read-line input)))
382 (if (string-prefix? "if [[ \"$term\"" line)
383 (begin (display "eval \"$cmd\"\n" output)
385 (begin (display (string-append line "\n") output)
386 (loop (read-line input))))))
387 (let* ((out (assoc-ref outputs "out"))
388 (bin (string-append out "/bin"))
389 (adder-out (string-append bin "/xapers-adder"))
390 (man1 (string-append out "/share/man/man1")))
391 (install-file "man/man1/xapers.1" man1)
392 (install-file "man/man1/xapers-adder.1" man1)
393 ;; below is equivalent to setting --no-term option
394 ;; permanently on; this is desirable to avoid imposing
395 ;; an x-terminal installation on the user but breaks
396 ;; some potential xapers-adder uses like auto browser
397 ;; pdf handler, but user could instead still use
398 ;; e.g. "xterm -e xapers-adder %F" for same use.
399 ;; alternatively we could propagate xterm as an input
400 ;; and replace 'x-terminal-emulator' with 'xterm'
401 (call-with-input-file "bin/xapers-adder"
403 (call-with-output-file adder-out
405 (purge-term-support input output)))))
406 (chmod adder-out #o555)))))))
407 (home-page "https://finestructure.net/xapers/")
408 (synopsis "Personal document indexing system")
410 "Xapers is a personal document indexing system,
411 geared towards academic journal articles build on the Xapian search engine.
412 Think of it as your own personal document search engine, or a local cache of
413 online libraries. It provides fast search of document text and
414 bibliographic data and simple document and bibtex retrieval.")
417 ;;; search.scm ends here