[ic] swish search - quotes

Kevin Walsh kevin at cursor.biz
Wed Feb 7 17:19:53 EST 2007


Dan Bergan <dan at berganconsulting.com> wrote:
> However it looks like I will have to do some hacking in Swish.pm it  
> looks like quotes are always removed as "unsafe charachers":
> $spec =~ s/[^-\w()"\s\*]+//g
> 	and $CGI::values{debug}
> 	and ::logError("Removed unsafe characters from search string");
> 
> (My regex skills may be a bit rusty, so please correct me if I'm  
> reading either of these wrong!)
> 
> Does this seem like a reasonable thing for me to do in Swish.pm:
> #removed quote char (") from regex
> $spec =~ s/[^-\w()\s\*]+//g
> 	and $CGI::values{debug}
> 	and ::logError("Removed unsafe characters from search string");
> 
> if ( $s->{mv_exact_match} ) {
>          $spec =~ s/"/\"/g;
> }
> else {
>          $spec =~ s/"//g;
> }
> 
> I'm getting a bit out of my element here, I would rather not have to  
> change a core file, so I would appreciate any easier ways to  
> accomplish this!
> 
Try the Vend::Swish2 module from Interchange 5.5 (CVS).  The setup is
the same, except change "Swish" to "Swish2" in config files.  You should
be able to just dump the lib/Vend/Swish2.pm file into any 5.4.x version,
and probably most other versions too.

Maybe Swish2 will fix your problem and maybe it won't.  I haven't looked
into it.  Swish2 makes use of the SWISH::API module (and friends) instead
of building up a swish-e command line and executing it in a shell.  As
there's no shell, there's no need to remove "unsafe" characters from the
search spec.

My RTFM website uses Interchange 5.5.0 and Vend::Swish2, so you could
try out a couple of searches there to see if you get the kind of results
you might expect.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/


More information about the interchange-users mailing list