Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

  1. Outdated egg!
  2. estraier
  3. Introduction
  4. Examples
    1. Indexing a document
    2. Searching for documents
  5. Authors
  6. License
  7. Requirements
    1. Debian



The Estraier Chicken egg is a thin wrapper around the Hyper Estraier API.


Indexing a document

The following code receives a path to a Estraier DB and a file and adds it to the DB:

(use estraier)
(define (estraier-update-document path-db path-text)
  (let ((doc (est-doc-new)))

    ; Here you could use an HTTP URL if your file is visible somewhere:
    (est-doc-add-attr doc "@uri" path-text)
    ; You will want to set the title to something more meaningful:
    (est-doc-add-attr doc "@title" path-text)

    (with-input-from-file path-text
      (lambda ()
        (let loop ((line (read-line)))
          (unless (eof-object? line)
            ; If your file is not in Unicode, use the iconv egg to convert
            ; the charset of the lines to Unicode.
            (est-doc-add-text doc line)
            (loop (read-line))))))

    (let ((db (est-db-open path-db (bitwise-ior *estdbwriter* *estdbcreat*))))
      (est-db-put-doc db doc *estpdclean*)
      (est-db-close db))))

Searching for documents

(use estraier)

(define (estraier-search path-data query)
  (let ((condition (est-cond-new)))
    (est-cond-set-phrase condition query)
    (let* ((db (est-db-open (svnwiki-make-pathname path-data "estraier-db") 0))
           (hints (cbmapopenex 32))
           (results (vector->list (est-db-search db condition hints)))
           (words (est-hints-to-words hints)))
        (lambda (id)
          (let ((doc (est-db-get-doc db id 0)))
              (est-doc-attr doc "@uri")
              (est-doc-attr doc "@title")
              (est-doc-make-snippet doc words 480 96 96))))


This egg is made by Alejandro Forero Cuervo <azul@freaks-unidos.net>.


The estraier egg is available under the GNU General Public License.


In order to build this egg you'll need to have Hyper Estraier and libQDBM. Note that you'll need the development packages for both.


In Debian, it suffices to install packages libestraier-dev and libqdbm-dev. The dependencies will take care of the rest.

As of this writing, Hyper Estraier is not available in Debian stable. You'll have to use testing.