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

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


User:      jon
Date:      2001-11-22 03:53:15 GMT
Modified:  lib/Vend 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
2.4       +14 -5     interchange/lib/Vend/DbSearch.pm


rev 2.4, prev_rev 2.3
Index: DbSearch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/DbSearch.pm,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -u -r2.3 -r2.4
--- DbSearch.pm	2001/10/30 19:00:44	2.3
+++ DbSearch.pm	2001/11/22 03:53:15	2.4
@@ -1,6 +1,6 @@
 # Vend::DbSearch - Search indexes with Interchange
 #
-# $Id: DbSearch.pm,v 2.3 2001/10/30 19:00:44 jon Exp $
+# $Id: DbSearch.pm,v 2.4 2001/11/22 03:53:15 jon Exp $
 #
 # Adapted for use with Interchange from Search::TextSearch
 #
@@ -26,7 +26,7 @@
 
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.3 $, 10);
+$VERSION = substr(q$Revision: 2.4 $, 10);
 
 use Search::Dict;
 use strict;
@@ -254,7 +254,10 @@
 		if(! defined $f and defined $limit_sub) {
 #::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($_);
 			}
@@ -262,7 +265,10 @@
 		elsif(defined $limit_sub) {
 #::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($_);
@@ -274,7 +280,10 @@
 		else {
 #::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($_);
 			}