[ic] Different mv_substring_match for diff. fields (resolved + patch)

Davor Ocelic docelic at spinlocksolutions.com
Thu Jul 3 21:07:47 UTC 2008


On Thu, 3 Jul 2008 21:45:46 +0200
Davor Ocelic <docelic at spinlocksolutions.com> wrote:

> On Thu, 3 Jul 2008 14:18:33 -0400
> Mike Heins <mike at perusion.com> wrote:
> 
> > > So the proposed solution is:
> > > 
> > > Instead of turning off mv_coordinate, let's just ensure that the
> > > number of search specs matches the number of search fields.
> > > (Taking user's setting of mv_coordinate=1 as a sign that he wants
> > > it to happen).

It turns out you could rely on the behavior of mv_coordinate being
turned off if specs != fields, so here's the final version of the patch
that introduces mv_force_coordinate:

--- /home/docelic/p/interchange/lib/Vend/Search.pm	2008-01-29 11:31:11.000000000 +0100
+++ Search.pm	2008-07-03 23:01:34.000000000 +0200
@@ -240,8 +240,22 @@
 	my $i = 0;
 #::logDebug($s->dump_coord(\@specs, 'BEFORE'));
 
-	$s->{mv_coordinate} = ''
-		unless $s->{mv_coordinate} and @specs == @{$s->{mv_search_field}};
+	if ( $s->{mv_force_coordinate} ) {
+		# If coordinated search is forced, ensure 
+		# @specs == @{$s->{mv_search_field}}:
+		if ( $s->{mv_coordinate} ) {
+			my $last = $#{$s->{mv_search_field}};
+			my $i;
+			for ($i = @specs; $i <= $last; $i++) {
+				$specs[$i] = $specs[$#specs];
+			}
+			$#specs = $last;
+		}
+	}
+	else {
+		$s->{mv_coordinate} = ''
+			unless $s->{mv_coordinate} and @specs == @{$s->{mv_search_field}};
+	}
 
 	my $all_chars = $s->{mv_all_chars}[0];
 
--- /home/docelic/p/interchange/lib/Vend/Scan.pm	2007-08-09 15:40:54.000000000 +0200
+++ Scan.pm	2008-07-03 22:43:20.000000000 +0200
@@ -59,6 +59,7 @@
 	mv_numeric
 	mv_column_op
 	mv_begin_string
+	mv_force_coordinate
 	mv_coordinate
 	mv_nextpage
 	mv_dict_end
@@ -136,6 +137,7 @@
 	dr  mv_record_delim
 	em  mv_exact_match
 	er  mv_spelling_errors
+	fc  mv_force_coordinate
 	ff  mv_field_file
 	fi  mv_search_file
 	ft  mv_field_title




More information about the interchange-users mailing list