Skip to main content.
home | support | download

Back to List Archive

Re: Phrase searching under Windows and Linux environments

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Mon Jan 10 2005 - 18:13:02 GMT
On Mon, Jan 10, 2005 at 06:13:00AM -0800, Harms, Jake E (JUS) wrote:
> In order to search the same phrase and get the same results in both
> environments, I find that I have to escape the quotes (with a backslash "\")
> in the Windows environment, but not in the Linux environment.

That's why it's easy to find things like this (from swish.cgi):

    # Ok, I'll say it.  Windows sucks.
    my @command = map { s/"/\\"/g; qq["$_"] }  $self->{prog}, $self->swish_command_array;
    my $pid = IPC::Open2::open2($rdrfh, $wtrfh, @command );


> 
> For example, in order to get the same results for the search term: "this
> phrase" (surrounded by quotes):
> The following PHP syntax works in the Linux environment: 
> 	$swish = "$path/swish-e";  /* path of swish-e command*/ 
> 	$search_index = "$path/swish/site-en.idx";  /* path of swish-e index
> file*/ 
> 	$srch_cmd = "$swish -w $srch_term -f  $search_index;

I'm sure there's a way in PHP to avoid running a command via the
shell.  That is a classic security hole.

I use IPC::Open2 to run the command on Windows, which is *suppose* to
avoid the windows shell.  Even so, it seems like windows eats the
quotes for some reason beyond my comprehension.

-- 
Bill Moseley
moseley@hank.org

Unsubscribe from or help with the swish-e list: 
   http://swish-e.org/Discussion/

Help with Swish-e:
   http://swish-e.org/current/docs
   swish-e@sunsite.berkeley.edu
Received on Mon Jan 10 10:13:02 2005