Xapian omega: simple URLs for users (Apache)
Posted 04-11-2011 at 11:59 AM by catkin
Xapian's Omega component is primarily used as tool for building interactive text searching solutions but can be used directly.
When using it directly, a typical URL is http://<host_ID>/cgi-bin/omega. That results in omega running with its default CGI parameters. The default CGI parameters can be over-ridden by specifying them on the URL, for example http://<host_ID>/cgi-bin/omega?DB=<index_ID>&FMT=<template_ID>.
There are two problems with such complex URLs: firstly they are not easy to remember or dictate so not ideal for user-land and secondly they do not allow the system administrator to change CGI parameters, for example to try out a new index database and back out the change if desired.
If an Apache web server is being used these problems can be solved using a Redirect as shown in this example which redirects http://<host_ID>/search to http://<host_ID>/cgi-bin/omega?DB=docoll
Notes:
When using it directly, a typical URL is http://<host_ID>/cgi-bin/omega. That results in omega running with its default CGI parameters. The default CGI parameters can be over-ridden by specifying them on the URL, for example http://<host_ID>/cgi-bin/omega?DB=<index_ID>&FMT=<template_ID>.
There are two problems with such complex URLs: firstly they are not easy to remember or dictate so not ideal for user-land and secondly they do not allow the system administrator to change CGI parameters, for example to try out a new index database and back out the change if desired.
If an Apache web server is being used these problems can be solved using a Redirect as shown in this example which redirects http://<host_ID>/search to http://<host_ID>/cgi-bin/omega?DB=docoll
Code:
<VirtualHost *:80> CustomLog "/var/log/apache2/xapian.access.log" combined DocumentRoot "/srv/docoll" <Directory "/srv/docoll"> AllowOverride None Options All Order Allow,Deny Allow from all </Directory> <Directory "/usr/lib/cgi-bin/omega/omega/"> AllowOverride None Options None Order Allow,Deny Allow from all </Directory> Redirect "/search" "/cgi-bin/omega?DB=docoll" ScriptAlias "/cgi-bin/" "/usr/lib/cgi-bin/omega/" ServerAdmin <email address hidden> ServerName "Document Collation" </VirtualHost>
- /srv/docoll is where the documents are stored.
- The Xapian Omega CGI binary is installed as /usr/lib/cgi-bin/omega/omega
- 'Directory "/usr/lib/cgi-bin/omega/omega/"' looks wrong -- it is not a directory; it is a file -- but this configuration does work.
Total Comments 0