Skip to main content.
home | support | download

Back to List Archive

Boolean "or" in AutoSwish

From: Nathaniel Meyers <Nathaniel.Meyers(at)not-real.ucop.edu>
Date: Fri Sep 05 1997 - 15:57:21 GMT
I had an interesting problem and an interesting solution trying to get
AutoSwish to use "or".

I wanted a radio button the user could check to limit a search to only new
pages.  New pages are those with a META tag named "New" valued at either
"Sp97" or "Fa97".  I edited the CGI Script which AutoSwish generated for me
(in hindsight I realize it'd have been easier to modify my form) so that
"New = (Fa97 or Sp97)" will be pushed into the querystring when the button
is selected.

But it didn't work.  Although

swish-e -w "New = (Fa97 or Sp97)" -f index.swish

will do a proper search,

swish-e -w New = (Fa97 or Sp97) -f index.swish

(without quote marks around the query) returns an error.  (swish-e seems to
be forgiving about lack of quote marks around the query if the query has no
parentheses.)  I fixed this by editing my CGI script changing

open(SWISH, "$swish -w $query -m $results -f $index|");

to

open(SWISH, "$swish -w \"$query\" -m $results -f $index|");

which forces my CGI script to include quotes around my query which allows
"or" searches to work properly.

I can't see any harm that adding the quote marks can cause.

-Nathaniel Meyers
University of California Press
Received on Fri Sep 5 16:01:33 1997