Skip to main content.
home | support | download

Back to List Archive

RE: Truncate error

From: Bill Meier <bill(at)not-real.insulators.com>
Date: Wed May 09 2001 - 17:28:12 GMT
At 12:59 PM 05/09/01, you wrote:
>Thanks for yours. I am calling query.pl (from surfutah.com) from my html 
>swish-e search form. The section of query.pl that attempts to implement -w 
>truncation function is:
>
># build the command string
>$command = "$swishexec -f \"$array{'swishindex'}\" -w 
>\"$array{'keywords'}\"";
>if ($array{'maxresults'} ne "") {
>   $command .= " -m $array{'maxresults'}";
>
>As to swish-e version, I see patches through 1/98 in various files, but I 
>have not been able to spot a version number.
>
> > I am using Swish-e to index my web site, using the html
>> > search form. All
>> > works well, except truncate. If I enter keyword admin*, I get
>> > administrative and the like. However, if I enter keywork
>> > resid*, I get no
>> > result, even though keyword residual gets several hits. Any
>> > suggestions
>> > what may be causing this uneven performance of the truncate function?
>> >
>> > Thanks from a newbie

I had this problem too, when using query.pl -- the problem is that it 
attempts to "know too much" about some of the swish syntax. In this case, 
it strips off the * character from the string before passing it to -w ... 
the reason the first query probably worked, is probably related to word 
stemming or something.

Anyway, to fix your problem, edit query.pl and add * just inside the 
closing square bracket in the two character lists below (as shown)

# check for valid characters in keywords
if ($array{'keywords'} =~ /[^a-zA-Z0-9-_\.\/\ 
\(\)€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–˜™š›œžàáâãäåæçèéêëìíîïðñòóôõöøŸùúûüýþÿ¸¡¿*]/) 
{
   $array{'keywords'} =~ s/[^a-zA-Z0-9-_\.\/\ 
\(\)€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–˜™š›œžàáâãäåæçèéêëìíîïðñòóôõöøŸùúûüýþÿ¸¡¿*]//g;
}

Should work fine after that!!

Also, this is not as critical as the above, but query.pl also "attempts" to 
highlight the matching words. It can't do a perfect job of this, but you 
can improve it's chances if you also add the * before the closing square 
bracket in this area of code too:

   for ($index=0; $index<=$#kw; $index++) {
     $kw[$index] =~ s/[(),:;*]//g;
     print "<!-- $kw[$index] -->\n";
      }

Bill
Received on Wed May 9 17:29:09 2001