Skip to main content.
home | support | download

Back to List Archive

Re: [SWISH-E:375] RE: Using Parentheses

From: Marjolein Katsma <webmaster(at)not-real.javawoman.com>
Date: Fri Jul 17 1998 - 05:46:59 GMT
At 15:47 1998-07-16 -0700, Roy Tennant wrote:
>
>In working with Leslie, we determined that the problem was a lack of
>quotes around the search string. I need to check the documentation, which
>I don't think is clear about the need for quotes around the query string
>to make sure it is parsed appropriately.
>Roy Tennant
>

I'm not so sure...

Go to this page: http://hshelp.com/search.phtml and try this formula:

	vtml and not(attribute or history)

and you'll get (4) results.
Then try this:

	"vtml and not(attribute or history)"

and you'll get NO results.

What I'm doing is *not* passing the argument within quotes, but I'm
"escaping" the whole command string.
The reason, of course is that on Unix '(' and ')' are special characters.
Escaping the command string makes sure ALL Unix special characters are
escaped so the complete command is interpreted by Swish. the (PHP)
statements I'm using:
				$command = "$swish -w $pattern -m $maxresults -f $index";
				exec (EscapeShellCmd($command), $result, $rc);
where $pattern is the exact string typed into the entry field.

BTW, the page I mentioned is for *test* purposes only - don't publish or
link to anywhere please!

I'm mentioning it here only so everyone on the list can see for themselves
that 1) quotes aren't needed (and can in fact lead to undesired results)
and 2) escaping a command string *is* needed - if only to make the system
reasonably secure.

Cheers,
Marjolein Katsma      webmaster@javawoman.com
Java Woman - http://javawoman.com/
Received on Thu Jul 16 22:56:33 1998