[interchange-cvs] interchange - jon modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon Aug 9 14:00:43 EDT 2004


User:      jon
Date:      2004-08-09 18:00:43 GMT
Modified:  lib/Vend Glimpse.pm Search.pm
Log:
Implement mv_hide_field search parameter and add Glimpse support for it
and the HIDE_FIELD database option.

Revision  Changes    Path
2.11      +17 -2     interchange/lib/Vend/Glimpse.pm


rev 2.11, prev_rev 2.10
Index: Glimpse.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Glimpse.pm,v
retrieving revision 2.10
retrieving revision 2.11
diff -u -u -r2.10 -r2.11
--- Glimpse.pm	9 Apr 2004 19:39:55 -0000	2.10
+++ Glimpse.pm	9 Aug 2004 18:00:43 -0000	2.11
@@ -1,6 +1,6 @@
 # Vend::Glimpse - Search indexes with Glimpse
 #
-# $Id: Glimpse.pm,v 2.10 2004/04/09 19:39:55 jon Exp $
+# $Id: Glimpse.pm,v 2.11 2004/08/09 18:00:43 jon Exp $
 #
 # Adapted for use with Interchange from Search::Glimpse
 #
@@ -26,7 +26,7 @@
 require Vend::Search;
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.10 $, 10);
+$VERSION = substr(q$Revision: 2.11 $, 10);
 use strict;
 use Vend::File;
 use Vend::Util;
@@ -120,6 +120,21 @@
 	for(@searchfiles) {
 		$_ = Vend::Util::catfile($s->{mv_base_directory}, $_)
 			unless Vend::Util::file_name_is_absolute($_);
+	}
+
+	unless ($s->{mv_no_hide} or $s->{mv_hide_field}) {
+		my $dbref = $s->{table} || undef;
+		if (! $dbref) {
+			my $table = $s->{mv_field_file};
+			$table =~ s:.*/::;
+			$table =~ s/\..*//;
+			$dbref = Vend::Data::database_exists_ref($table);
+		}
+		if ($dbref) {
+			my $hf = $dbref->config('HIDE_FIELD');
+			$s->{mv_hide_field} = $hf if defined $hf;
+#::logDebug("mv_hide_field=$hf");
+		}
 	}
 
 #::logDebug("gsearch: self=" . ::Vend::Util::uneval_it({%$s}));



2.25      +24 -2     interchange/lib/Vend/Search.pm


rev 2.25, prev_rev 2.24
Index: Search.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Search.pm,v
retrieving revision 2.24
retrieving revision 2.25
diff -u -u -r2.24 -r2.25
--- Search.pm	19 Jul 2004 22:26:00 -0000	2.24
+++ Search.pm	9 Aug 2004 18:00:43 -0000	2.25
@@ -1,6 +1,6 @@
 # Vend::Search - Base class for search engines
 #
-# $Id: Search.pm,v 2.24 2004/07/19 22:26:00 mheins Exp $
+# $Id: Search.pm,v 2.25 2004/08/09 18:00:43 jon Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -22,7 +22,7 @@
 
 package Vend::Search;
 
-$VERSION = substr(q$Revision: 2.24 $, 10);
+$VERSION = substr(q$Revision: 2.25 $, 10);
 
 use strict;
 use vars qw($VERSION);
@@ -685,6 +685,22 @@
 		$code       = "sub {\nmy \$line = shift;\n";
 	}
 	$code .= "my \@fields = \@\$line;\n";
+
+	my $have_hf;
+	if ($s->{mv_hide_field}) {
+		$s->{mv_field_hash} = create_field_hash($s) 
+			unless $s->{mv_field_hash};
+		my $hf = $s->{mv_field_hash}{$s->{mv_hide_field}};
+		if (defined $hf) {
+			$code .= "return if \$fields[$hf];\n";
+			$have_hf = 1;
+		}
+		else {
+		 	::logError("Ignoring unknown mv_hide_field specification: $s->{mv_hide_field}");
+			delete $s->{mv_hide_field};
+		}
+	}
+		
 	my $join_key;
 	$join_key = defined $s->{mv_return_fields} ? $s->{mv_return_fields}[0] : 0;
 	$join_key = 0 if $join_key eq '*';
@@ -971,6 +987,12 @@
 		$code .= <<EOF;
 	$range_code
 	$ender
+}
+EOF
+	}
+	elsif ($have_hf) {
+		$code .= <<'EOF';
+return 1;
 }
 EOF
 	}








More information about the interchange-cvs mailing list