[interchange-cvs] interchange - jon modified 8 files

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Sat Jun 22 21:21:02 2002


User:      jon
Date:      2002-06-23 01:20:11 GMT
Modified:  dist/lib/UI/pages/admin layout_auto.html
Modified:  lib/Vend DbSearch.pm Glimpse.pm Interpolate.pm RefSearch.pm
Modified:           Scan.pm Search.pm TextSearch.pm
Log:
Add option to disable matchlimit entirely, with ml=all or ml=none.
Allow default of 50 to be changed in catalog variable MV_DEFAULT_MATCHLIMIT.

Revision  Changes    Path
2.3       +10 -12    interchange/dist/lib/UI/pages/admin/layout_auto.html


rev 2.3, prev_rev 2.2
Index: layout_auto.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/layout_auto.html,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -u -r2.2 -r2.3
--- layout_auto.html	31 Oct 2001 19:00:55 -0000	2.2
+++ layout_auto.html	23 Jun 2002 01:20:10 -0000	2.3
@@ -34,7 +34,7 @@
 </tr>
 
 <tr bgcolor="__UI_C_INTBLOCK__">
-<td width=25%>
+<td width="25%">
 
 1. Choose a table as the source:
 
@@ -232,7 +232,10 @@
 		$adb->config('AUTO_NUMBER', '1000') if ! $adb->config('_Auto_number');
 		return "area column $acol doesn't exist"
 			unless $pdb->column_exists($acol);
-		my $ary = $pdb->query("select distinct $acol from $ptab order by $acol")
+		my $ary = $pdb->query({
+				sql => "select distinct $acol from $ptab order by $acol",
+				ml  => 'all',
+			})
 			or return "area column query failed";
 		for(@$ary) {
 			my ($area) = (@$_);
@@ -250,9 +253,10 @@
 		$cdb->config('AUTO_NUMBER', '1000') if ! $cdb->config('_Auto_number');
 		return "cat column $ccol doesn't exist"
 			unless $pdb->column_exists($ccol);
-		my ($ary, $fh) = $pdb->query(
-								"select $acol, $ccol from $ptab order by $ccol",
-								)
+		my ($ary, $fh) = $pdb->query({
+				sql => "select $acol, $ccol from $ptab order by $ccol",
+				ml  => 'all',
+			})
 			or return "cat column query failed";
 		foreach my $row (@$ary) {
 			my $area = $row->[$fh->{$acol}];
@@ -277,7 +281,7 @@
 	$CGI->{mv_nextpage} = $go_page;
 	my $out = $Tag->uneval( { ref => \%catmap } );
 	$out =~ s/,/,\n/g;
-	#return '<XMP>' . $Tag->uneval( { ref => \%catmap } ) . "</XMP";
+	#return '<XMP>' . $Tag->uneval( { ref => \%catmap } ) . "</XMP>";
 	return;
 [/perl]
 [/seti]
@@ -298,9 +302,3 @@
 <!-- ----- END REAL STUFF ----- -->
 @_UI_STD_FOOTER_@
 <!-- page: @@MV_PAGE@@ -->
-
-
-
-
-
-



2.13      +3 -3      interchange/lib/Vend/DbSearch.pm


rev 2.13, prev_rev 2.12
Index: DbSearch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/DbSearch.pm,v
retrieving revision 2.12
retrieving revision 2.13
diff -u -u -r2.12 -r2.13
--- DbSearch.pm	22 Jun 2002 22:38:38 -0000	2.12
+++ DbSearch.pm	23 Jun 2002 01:20:10 -0000	2.13
@@ -1,6 +1,6 @@
 # Vend::DbSearch - Search indexes with Interchange
 #
-# $Id: DbSearch.pm,v 2.12 2002/06/22 22:38:38 edl Exp $
+# $Id: DbSearch.pm,v 2.13 2002/06/23 01:20:10 jon Exp $
 #
 # Adapted for use with Interchange from Search::TextSearch
 #
@@ -26,7 +26,7 @@
 
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.12 $, 10);
+$VERSION = substr(q$Revision: 2.13 $, 10);
 
 use Search::Dict;
 use strict;
@@ -320,7 +320,7 @@
 
 	$s->{matches} = scalar(@out);
 
-	if ($s->{matches} > $s->{mv_matchlimit}) {
+	if ($s->{matches} > $s->{mv_matchlimit} and $s->{mv_matchlimit} > 0) {
 		$s->save_more(\@out)
 			or ::logError("Error saving matches: $!");
 		if ($s->{mv_first_match}) {



2.5       +3 -3      interchange/lib/Vend/Glimpse.pm


rev 2.5, prev_rev 2.4
Index: Glimpse.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Glimpse.pm,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -u -r2.4 -r2.5
--- Glimpse.pm	17 Jun 2002 22:24:07 -0000	2.4
+++ Glimpse.pm	23 Jun 2002 01:20:10 -0000	2.5
@@ -1,6 +1,6 @@
 # Vend::Glimpse - Search indexes with Glimpse
 #
-# $Id: Glimpse.pm,v 2.4 2002/06/17 22:24:07 jon Exp $
+# $Id: Glimpse.pm,v 2.5 2002/06/23 01:20:10 jon Exp $
 #
 # Adapted for use with Interchange from Search::Glimpse
 #
@@ -25,7 +25,7 @@
 require Vend::Search;
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.4 $, 10);
+$VERSION = substr(q$Revision: 2.5 $, 10);
 use strict;
 
 sub array {
@@ -330,7 +330,7 @@
 		$s->{matches} = scalar(@out);
 	}
 
-	if ($s->{matches} > $s->{mv_matchlimit}) {
+	if ($s->{matches} > $s->{mv_matchlimit} and $s->{mv_matchlimit} > 0) {
 		$s->save_more(\@out)
 			or ::logError("Error saving matches: $!");
 		if ($s->{mv_first_match}) {



2.70      +5 -4      interchange/lib/Vend/Interpolate.pm


rev 2.70, prev_rev 2.69
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.69
retrieving revision 2.70
diff -u -u -r2.69 -r2.70
--- Interpolate.pm	18 Jun 2002 15:01:45 -0000	2.69
+++ Interpolate.pm	23 Jun 2002 01:20:10 -0000	2.70
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.69 2002/06/18 15:01:45 jon Exp $
+# $Id: Interpolate.pm,v 2.70 2002/06/23 01:20:10 jon Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.69 $, 10);
+$VERSION = substr(q$Revision: 2.70 $, 10);
 
 @EXPORT = qw (
 
@@ -3503,7 +3503,8 @@
 #::logDebug("more_list: opt=$opt label=$opt->{label}");
 	return undef if ! $opt;
 	$q = $opt->{object} || $::Instance->{SearchObject}{$opt->{label}};
-	return '' unless $q->{matches} > $q->{mv_matchlimit};
+	return '' unless $q->{matches} > $q->{mv_matchlimit}
+		and $q->{mv_matchlimit} > 0;
 	my($arg,$inc,$last,$m);
 	my($adder,$pages);
 	my $next_tag = '';
@@ -3888,7 +3889,7 @@
 			and $text =~ s,$IE$QR{'/_field'},[/if-$Prefix-data],g;
 	}
 #::logDebug("Past only products.");
-	$end =	$obj->{mv_matchlimit}
+	$end =	($obj->{mv_matchlimit} and $obj->{mv_matchlimit} > 0)
 			? $i + ($opt->{ml} || $obj->{mv_matchlimit}) - 1
 			: $#$ary;
 	$end = $#$ary if $#$ary < $end;



2.3       +3 -3      interchange/lib/Vend/RefSearch.pm


rev 2.3, prev_rev 2.2
Index: RefSearch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/RefSearch.pm,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -u -r2.2 -r2.3
--- RefSearch.pm	17 Jun 2002 22:24:08 -0000	2.2
+++ RefSearch.pm	23 Jun 2002 01:20:10 -0000	2.3
@@ -1,6 +1,6 @@
 # Vend::DbSearch - Search indexes with Interchange
 #
-# $Id: RefSearch.pm,v 2.2 2002/06/17 22:24:08 jon Exp $
+# $Id: RefSearch.pm,v 2.3 2002/06/23 01:20:10 jon Exp $
 #
 # Adapted for use with Interchange from Search::TextSearch
 #
@@ -26,7 +26,7 @@
 
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.2 $, 10);
+$VERSION = substr(q$Revision: 2.3 $, 10);
 
 use strict;
 
@@ -258,7 +258,7 @@
 	## or ITL
 	return @out if $s->{mv_return_filtered};
 
-	if ($s->{matches} > $s->{mv_matchlimit}) {
+	if ($s->{matches} > $s->{mv_matchlimit} and $s->{mv_matchlimit} > 0) {
 		$s->save_more(\@out)
 			or ::logError("Error saving matches: $!");
 		if ($s->{mv_first_match}) {



2.11      +10 -3     interchange/lib/Vend/Scan.pm


rev 2.11, prev_rev 2.10
Index: Scan.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Scan.pm,v
retrieving revision 2.10
retrieving revision 2.11
diff -u -u -r2.10 -r2.11
--- Scan.pm	22 Jun 2002 22:30:22 -0000	2.10
+++ Scan.pm	23 Jun 2002 01:20:10 -0000	2.11
@@ -1,6 +1,6 @@
 # Vend::Scan - Prepare searches for Interchange
 #
-# $Id: Scan.pm,v 2.10 2002/06/22 22:30:22 edl Exp $
+# $Id: Scan.pm,v 2.11 2002/06/23 01:20:10 jon Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -29,7 +29,7 @@
 			perform_search
 			);
 
-$VERSION = substr(q$Revision: 2.10 $, 10);
+$VERSION = substr(q$Revision: 2.11 $, 10);
 
 use strict;
 use Vend::Util;
@@ -201,7 +201,7 @@
 	mv_dict_limit           =>  \&_dict_limit,
 	mv_exact_match          =>  \&_yes,
 	mv_head_skip            =>  \&_number,
-	mv_matchlimit           =>  sub { $_[1] =~ /(\d+)/ ? $1 : 50 },
+	mv_matchlimit           =>  \&_matchlimit,
 	mv_max_matches          =>  sub { $_[1] =~ /(\d+)/ ? $1 : -1 },
 	mv_min_string           =>  sub { $_[1] =~ /(\d+)/ ? $1 : 1 },
 	mv_profile              =>  \&parse_profile,
@@ -951,6 +951,13 @@
 	$ref->{mv_dict_end} = $ref->{mv_dict_look};
 	substr($ref->{mv_dict_end},$limit,1) =~ s/(.)/chr(ord($1) + 1)/e;
 	return $_[1];
+}
+
+sub _matchlimit {
+	shift;
+	my $val = lc(shift);
+	return -1 if $val eq 'none' or $val eq 'all';
+	return int($val) || $::Variable->{MV_DEFAULT_MATCHLIMIT} || 50;
 }
 
 1;



2.9       +3 -3      interchange/lib/Vend/Search.pm


rev 2.9, prev_rev 2.8
Index: Search.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Search.pm,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -u -r2.8 -r2.9
--- Search.pm	17 Jun 2002 22:24:08 -0000	2.8
+++ Search.pm	23 Jun 2002 01:20:10 -0000	2.9
@@ -1,6 +1,6 @@
 # Vend::Search - Base class for search engines
 #
-# $Id: Search.pm,v 2.8 2002/06/17 22:24:08 jon Exp $
+# $Id: Search.pm,v 2.9 2002/06/23 01:20:10 jon Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -21,7 +21,7 @@
 
 package Vend::Search;
 
-$VERSION = substr(q$Revision: 2.8 $, 10);
+$VERSION = substr(q$Revision: 2.9 $, 10);
 
 use strict;
 use vars qw($VERSION);
@@ -1026,7 +1026,7 @@
 	delete $s->{dbref} if defined $s->{dbref};
 	my $id = $s->{mv_more_id} || $Vend::SessionID;
 	$id .= ".$s->{mv_cache_key}";
-	if ($s->{matches} > $s->{mv_matchlimit}) {
+	if ($s->{matches} > $s->{mv_matchlimit} and $s->{mv_matchlimit} > 0) {
 		$s->{overflow} = 1;
 		$s->{mv_next_pointer} = $s->{mv_matchlimit};
 	}



2.9       +3 -3      interchange/lib/Vend/TextSearch.pm


rev 2.9, prev_rev 2.8
Index: TextSearch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/TextSearch.pm,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -u -r2.8 -r2.9
--- TextSearch.pm	22 Jun 2002 22:38:38 -0000	2.8
+++ TextSearch.pm	23 Jun 2002 01:20:10 -0000	2.9
@@ -1,6 +1,6 @@
 # Vend::TextSearch - Search indexes with Perl
 #
-# $Id: TextSearch.pm,v 2.8 2002/06/22 22:38:38 edl Exp $
+# $Id: TextSearch.pm,v 2.9 2002/06/23 01:20:10 jon Exp $
 #
 # Adapted for use with Interchange from Search::TextSearch
 #
@@ -28,7 +28,7 @@
 use vars qw(@ISA);
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.8 $, 10);
+$VERSION = substr(q$Revision: 2.9 $, 10);
 
 use Search::Dict;
 use strict;
@@ -345,7 +345,7 @@
 
 	$s->{matches} = scalar(@out);
 
-	if ($s->{matches} > $s->{mv_matchlimit}) {
+	if ($s->{matches} > $s->{mv_matchlimit} and $s->{mv_matchlimit} > 0) {
 		$s->save_more(\@out)
 			or ::logError("Error saving matches: $!");
 		if ($s->{mv_first_match}) {