MM: Swish.pl ??? auf dem Xitami Webserver ???

Hallo ...

Ich hab  mir heute von XITAMI.COM das Such-Programm SWISH downgeloaden ...
Bei mir im C:\XITAMI\SWISH\ liegt die SWISH.EXE, die das erstelle Verzeinis (INDEX.SWISH) durchsucht. Im CGI-BIN-Verzeichniss von meinem Webserver liegt die SWISH.PL, die aber irgendwie nicht ganz funktioniert, wenn man einen Suchbegriff eingibt.

Da ich mich leider nicht sehr gut (eigentlich fast gar nicht) in PERL auskenne, hoffe ich, dass ihr mir weiterhelfen könnt ...

Was ist an diesem PERL-SCRIPT falsch??
(Ich glaub irgendwas hats mit der <RES> Variable ...)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

#!/usr/bin/perl
#################################################################################
#   Version 1.03      #
#          #
#   by Oleg Yu. Repin     #
#   Supercomputer Software Department RAS   #
#   Computing Center, Academgorodok, Novosibirsk, Russia #

SWISH  repin@ssd.sscc.ru, http://ssd.sscc.ru/repin/

Search

#   SWISH Search requires SWISH engine to work.  #
#   Information on SWISH engine could be found  #
#   at the URL http://www.eit.com/software/swish/  #
#          #
#   Latest information on SWISH Search can be found  #
#   at the URL http://www.ssd.sscc.ru/repin/swish/  #
#################################################################################
#   SWISH Search is distributed under the same License #
#   Agreement as SWISH License, where `Enterprise  #

License  Integration Technologies Corporation' should be

Agreement replaced to `Computing Center SB RAS' and

#   United States' to Russia'.    #
#   SWISH License is included into SWISH distribution. #
#################################################################################

REQUIRED

Firstly check the path to PERL executable in the first line of the script.

Then check the following variables:

$swish_path =  '/xitami/swish/swish.exe';          # path to SWISH executable

$index_path =  '/xitami/swish/index.swish'; # path to index file,
       # produced by SWISH

$swish_search = '/cgi-bin/swish.pl';  # actual URL of swish.pl script

You should carefully set configuration options in your `swish.conf' file.

SWISH Search imports IndexName' and IndexPointer' values and

its behaviour considerably depends on `ReplaceRules' settings.

#################################################################################

YOUR CHOICE

%form = ( 'stag', 'HBthe', # default `Search only' choice [All];
    # should be 't' for Titles or 'h' for Headers

'nres', '10' ); # default `Number of results' choice

$bgcolor =     '"#d9d9d9"'; # background color
$textcolor =   'black';  # text color on bgcolor' background $atextcolor =  'white';  # text color on linkcolor' background and
    # activ link color
$headercolor = 'maroon'; # headers color
$linkcolor =   'blue';  # links color and alternate background
$alinkcolor =  'lime';  # links color on `linkcolor' background
$vlinkcolor =  'navy';  # visited links color

#################################################################################

YOU SHOULD NOT ALTER THE REST OF THE SCRIPT

read( STDIN, $buffer, $ENV{ 'CONTENT_LENGTH' } );
@pairs = split( /&/, $buffer );

foreach $pair( @pairs )
{
  ( $name, $value ) = split( /=/, $pair );

$value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;

$form{ $name } = $value;
}

open( RES, ( $form{ 'terms' } ) ?
  "$swish_path -f $index_path -m $form{ 'nres' } -t $form{ 'stag' } -w $form{ 'terms' } |" :
  "$swish_path -f $index_path -m 1 -w 0 |" );

_1: while( <RES> )
{
  $Name = $1 if /^# Name: (.*)$/o;
  $Pointer = $1 if /^# Pointer: (.*)$/o;
  last _1 if defined( $Name ) && defined( $Pointer );
  $error = $1 if /^err: (.*)$/o;
  $error = 'Invalid search words' if /^options:/o;
}

$hc = "FONT COLOR=$headercolor";
$atc = "FONT COLOR=$atextcolor";
$alc = "FONT COLOR=$alinkcolor";

$_ = <<EOP;
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
 <HTML>
 <HEAD>
 <TITLE>SWISH Search</TITLE>
 </HEAD>
 <BODY TEXT=$textcolor BGCOLOR=$bgcolor LINK=$linkcolor VLINK=$vlinkcolor ALINK=$atextcolor>

<TABLE CELLSPACING=6 CELLPADDING=1 BORDER=0 BGCOLOR=black><TR><TD>
 <TABLE CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR=white><TR><TD>
 <TABLE CELLSPACING=0 CELLPADDING=5 BORDER=0><TR><TH BGCOLOR=$linkcolor><$atc SIZE="+1">
 SWISH Search: <A HREF="$Pointer"><$alc>$Name</FONT></A>
 </TH></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE>
 <BR><BR>

<FORM ACTION="$swish_search" METHOD="POST">
 <$hc>Search words: </FONT>
 <INPUT TYPE=text NAME="terms" SIZE=45 VALUE="$form{ 'terms' }">

<FONT COLOR=$linkcolor><INPUT TYPE=submit VALUE=" Do search " ALIGN=top></FONT><BR>

<$hc>Search only:</FONT>
 <INPUT TYPE=radio NAME="stag" VALUE="t"> Titles
 <INPUT TYPE=radio NAME="stag" VALUE="h"> Headers
 <INPUT TYPE=radio NAME="stag" VALUE="HBthe"> All

<$hc>Number of results:</FONT>
 <INPUT TYPE=radio NAME="nres" VALUE="10"> 10
 <INPUT TYPE=radio NAME="nres" VALUE="25"> 25
 <INPUT TYPE=radio NAME="nres" VALUE="50"> 50
 </FORM>
EOP

s/VALUE=.$form{ 'stag' }./$& CHECKED/o;
s/VALUE=.$form{ 'nres' }./$& CHECKED/o;

print;

if( $error )
{
  print "<BR><$hc><B>Error:</B></FONT> $error<BR><BR><BR>\n";
}
elsif( $form{ 'terms' } )
{
  print "<BR><$hc><B>Documents found:</B></FONT>   <SMALL>(red <FONT COLOR=red>¶</FONT> sign shows confidence in the match, best mached first)</SMALL><BR><BR>\n";

while( <RES> )
  {
    print "<FONT SIZE="+0" COLOR="".( $1 > 99 ? 'red' : 'black' ).
        ""><B>¶</B></FONT> <A HREF="$2">$3</A> <SMALL>($4 bytes)</SMALL><BR>"
      if /^([0-9]*) +([^ ]*) +.([^"]*). +([0-9]*)/o;
    print "No documents found<BR>\n" if /^err/o;
  }
  print "<BR>\n";
}
else
{
  print <<EOP;
 <BR>
 <H4><$hc>Search tips</FONT></H4>
 <UL>
 <P> You can use the booleans <CODE>and</CODE>, <CODE>or</CODE>, or <CODE>not</CODE> in searching.
 Without these booleans, we will assume you're <CODE>and</CODE>ing the words together.
 Evaluation takes place from left to right only, although you can use parentheses
 to force the order of evaluation.</P>
 <P> You can also use wildcards (asterisks) to search for matches to the beginnings
 of words only - you can't put asterisks at the front or in the middle of words.</P>
 <BLOCKQUOTE>
 <P> example 1: <code>john and doe or jane</code><BR>
 example 2: <code>john and (doe or not jane)</code><BR>
 example 3: <code>not (john or jane) and doe</code><BR>
 example 4: <code>j* and doe</code></P>
 </BLOCKQUOTE>
 1. This search evaluates the expression from left to right.<BR>
 2. This search will also be evaluated from left to right, although the operation in parentheses will be evaluated as a whole first.<BR>
 3. <code>john or jane</code> will be evaluated first, a <code>not</code> operation will be performed on that, then everything will be <code>and</code>ed with <code>doe</code>.<BR>
 4. This will search for all pages that contain words starting with the letter <code>j</code> and that also contain <code>doe</code>.
 </UL>
EOP
}

print <<EOP;
 <TABLE CELLSPACING=6 CELLPADDING=1 BORDER=0 BGCOLOR=black ALIGN=right><TR><TD>
 <TABLE CELLSPACING=0 CELLPADDING=2 BORDER=0 BGCOLOR=white><TR><TD>
 <TABLE CELLSPACING=0 CELLPADDING=5 BORDER=0><TR><TH BGCOLOR=$linkcolor><$atc SIZE="-1">
 Resulted by <A HREF="http://www.eit.com/software/swish/"><$alc>SWISH</FONT></A>   (C) Kevin Hughes, EIT &<BR>
 <A HREF="http://www.ssd.sscc.ru/repin/swish/"><$alc>SWISH Search 1.03</FONT></A>   (C) Oleg Yu. Repin, RAS
 </TR></TABLE></TD></TR></TABLE></TD></TR></TABLE>

</BODY>
 </HTML>
EOP

__END__

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Ich hoffe, dass ihr mir helfen könnt ...

LG,
MM