[interchange-cvs] interchange - racke modified lib/Vend/Swish.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Tue Apr 18 05:17:39 EDT 2006


User:      racke
Date:      2006-04-18 09:17:39 GMT
Modified:  lib/Vend Swish.pm
Log:
don't consider missing matches as search error

Revision  Changes    Path
1.9       +12 -6     interchange/lib/Vend/Swish.pm


rev 1.9, prev_rev 1.8
Index: Swish.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Swish.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Swish.pm	10 Apr 2006 20:27:37 -0000	1.8
+++ Swish.pm	18 Apr 2006 09:17:38 -0000	1.9
@@ -1,6 +1,6 @@
 # Vend::Swish - Search indexes with Swish-e
 #
-# $Id: Swish.pm,v 1.8 2006/04/10 20:27:37 racke Exp $
+# $Id: Swish.pm,v 1.9 2006/04/18 09:17:38 racke Exp $
 #
 # Adapted from Vend::Glimpse
 #
@@ -26,7 +26,7 @@
 require Vend::Search;
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 1.8 $, 10);
+$VERSION = substr(q$Revision: 1.9 $, 10);
 use strict;
 
 sub array {
@@ -261,10 +261,16 @@
 			push @out, $return_sub->($_);
 		}
 	}
-
-	if(scalar(@out) == 1 and $out[0][0] =~ s/^err\w*\W+//)  {
-		$s->{matches} = -1;
-		return $s->search_error($out[0][0]);
+	
+	if(scalar(@out) == 1 and $out[0][0] =~ s/^err:\s*(.*?)\s*$//)  {
+		# presumably search error signaled by Swish
+		@out = ();
+
+		# don't consider missing matches as search error
+	    unless ($1 eq 'no results') {
+			$s->{matches} = -1;
+			return $s->search_error($1);
+		}
 	}
 
 	$s->{matches} = scalar(@out);








More information about the interchange-cvs mailing list