[Xapian-discuss] Omega behaves differently

Richard Boulton richard at lemurconsulting.com
Sun Jan 7 13:00:05 GMT 2007


Jim wrote:
> I don't understand what's going on with omega.  I have a cgi script that
> is calling omega using the back tics, such as
> `/usr/local/lib/omega/bin/omega FMT=mail.xml DB=/current DEFAULTOP=and 
> P=search`

Omega can take input from the standard CGI environment variables, or 
from the command line, or from standard input.  However, if CGI 
variables are set (as they will be since you're calling omega from 
within a CGI script), the CGI variables take precedence.

If you want to force omega to ignore these CGI variables, you can 
currently do this by unsetting the "REQUEST_METHOD" environment 
variable.  It will then pay attention to command line parameters if 
there are any, or listen for arguments on stdin if there are no command 
line parameters.

You could, of course, just set all the CGI variables yourself, instead 
of passing the parameters on the command line - but you'd have to be 
careful to clear any other CGI variables to avoid passing values through 
directly from (ab)users of your script.  So, forcing it to just use the 
command line parameters is probably the best plan.

 > Any ideas as to why this is not working as expected?

As I understand it, the command line and stdin methods of controlling 
omega were really written for debugging purposes, which is why they 
don't take precedence in the presence of CGI environment variables. 
That said, I can't really see why you shouldn't use them in the way 
you're doing.

See omega.cc, around line 107 (or search for "REQUEST_METHOD"), for the 
code that works out where to get the parameters from.

-- 
Richard



More information about the Xapian-discuss mailing list