[interchange-cvs] interchange - jon modified lib/Vend/DbSearch.pm

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Wed Nov 21 22:50:00 2001


User:      jon
Date:      2001-11-22 03:49:59 GMT
Modified:  lib/Vend Tag: STABLE_4_8-branch DbSearch.pm
Log:
Fix bug that caused search results corruption if any fields (not just
fields returned) in a given row contained a tab character. Affected e.g.
[search-region] and thus the admin/item.html page.

Revision  Changes    Path
No                   revision



No                   revision



2.0.2.5   +17 -8     interchange/lib/Vend/DbSearch.pm


rev 2.0.2.5, prev_rev 2.0.2.4
Index: DbSearch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/DbSearch.pm,v
retrieving revision 2.0.2.4
retrieving revision 2.0.2.5
diff -u -u -r2.0.2.4 -r2.0.2.5
--- DbSearch.pm	2001/11/21 20:52:51	2.0.2.4
+++ DbSearch.pm	2001/11/22 03:49:58	2.0.2.5
@@ -1,6 +1,6 @@
 # Vend::DbSearch - Search indexes with Interchange
 #
-# $Id: DbSearch.pm,v 2.0.2.4 2001/11/21 20:52:51 jon Exp $
+# $Id: DbSearch.pm,v 2.0.2.5 2001/11/22 03:49:58 jon Exp $
 #
 # Adapted for use with Interchange from Search::TextSearch
 #
@@ -26,7 +26,7 @@
 
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.0.2.4 $, 10);
+$VERSION = substr(q$Revision: 2.0.2.5 $, 10);
 
 use Search::Dict;
 use strict;
@@ -253,17 +253,23 @@
 		$@  and  return $s->search_error("Return subroutine creation: $@");
 
 		if(! defined $f and defined $limit_sub) {
-#::logDebug("no f, limit, dbref=$dbref");
+::logDebug("no f, limit, dbref=$dbref");
 			local($_);
-			while($_ = join "\t", $dbref->each_nokey($qual || undef) ) {
+			while ($_ = join "\t",
+						map { s/\t/ /g; $_ }
+						$dbref->each_nokey($qual || undef)
+					) {
 				next unless &$limit_sub($_);
 				push @out, &$return_sub($_);
 			}
 		}
 		elsif(defined $limit_sub) {
-#::logDebug("f and limit, dbref=$dbref");
+::logDebug("f and limit, dbref=$dbref");
 			local($_);
-			while($_ = join "\t", $dbref->each_nokey($qual || undef) ) {
+			while ($_ = join "\t",
+						map { s/\t/ /g; $_ }
+						$dbref->each_nokey($qual || undef)
+					) {
 				next unless &$f();
 				next unless &$limit_sub($_);
 				push @out, &$return_sub($_);
@@ -273,9 +279,12 @@
 			return $s->search_error('No search definition');
 		}
 		else {
-#::logDebug("f and no limit, dbref=$dbref");
+::logDebug("f and no limit, dbref=$dbref");
 			local($_);
-			while($_ = join "\t", $dbref->each_nokey($qual || undef) ) {
+			while ($_ = join "\t",
+						map { s/\t/ /g; $_ }
+						$dbref->each_nokey($qual || undef)
+					) {
 				next unless &$f();
 				push @out, &$return_sub($_);
 			}