Setting up Xapian Omega for searching a small business document store

This article shows how to configure Xapian Omega to index a document store and create a basic web page for searching that will allow (Windows) users to easily navigate to matching files.

The approach taken is to create a template which emits links of the form "omegalink://dbname/path/to/file". Windows will run the OmegaLink protocol handler which looks up the UNC prefix for the dbname and calls Windows Explorer to navigate to the containing folder and then high light the file.

This has been tested on Windows 7 and Windows 10 (but should work on anything capable of running PowerShell), nginx and Lighttpd (but should work on Apache etc)

Note that this was written on FreeBSD - your paths may differ.



  1. Index the desired documents using omindex, in this example we are indexing 2 separate directories:
    1. /omega/admin
    2. /omega/projects

You will need to ensure you have omindex setup correctly for the document types you wish to index

  1. Create a suitable template file at /usr/local/etc/omega/templates/query. The important part is to create the omegalink:// URLs - see the attached 'query' template for more details. The key parts are..
    1. Database selection. We specify the multiple databases directly rather than using a stub database because otherwise subdb won't 'see' them, eg
      <select name=DB>
          <option value="admin/projects" $if{$eq{$dbname,admin/work},selected="selected"}>Everything</option>
          <option value="admin" $if{$eq{$dbname,admin},selected="selected"}>admin</option>
          <option value="projects" $if{$eq{$dbname,projects},selected="selected"}>projects</option>
    2. Generating the omegalink:// URLs using $subdb and the URL. In this example the DB name will appear in the omegalink URL as the host (which OmegaLink keys off, see below)
      <a href="omegalink://$html{$subdb}$html{$field{url}}">Visit Locally</a>
      <a href="$html{$field{url}}">Download</a><br>
  1. Configure the web server to serve the CGI file. For nginx this looks like..
        server {
            listen [::]:443 ssl;
            listen 443 ssl;
            server_name search.mydomain;
            auth_basic "Search";
            include /usr/local/etc/nginx/auth.conf;
            location / {
                root /usr/local/www/xapian-omega/cgi-bin;
                rewrite ^/(.*) /$1 break;
                fastcgi_pass unix:/ssd/omega/cgi.sock;
                fastcgi_param SCRIPT_FILENAME /usr/local/www/xapian-omega/cgi-bin/$fastcgi_script_name;
                include fastcgi_params;
    For Lighttpd you will need to enable the cgi and alias modules and set var.server_root to /usr/local/www/xapian-omega/ and uncomment the example in /usr/local/etc/lighttpd/conf.d/cgi.conf (see the lightttpd-conf.diff attachment)
  1. Install and configure OmegaLink on each end user computer. Since we have multiple databases we need to install a registry file after the MSI has been installed that looks like
    This configures OmegaLink to prefix URLs which have a host of projects with \\server\projects and admin with \\server\admin.
  1. Test it.

Visit the search page (eg https://search.mydomain) and check the links produced.

Last modified 16 months ago Last modified on 18/09/18 23:12:06

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.