[interchange-cvs] interchange - danb modified lib/Vend/Interpolate.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Oct 29 01:02:02 EDT 2004


User:      danb
Date:      2004-10-29 05:02:02 GMT
Modified:  lib/Vend Interpolate.pm
Log:
 * Fix [query] causes [more] to generate non-unique mv_cache_key.

The [more] tag generates a unique mv_cache_key for [list], [search-region],
etc., but when used with [query], it never does.  This is because it is
using an incorrect "message" for generating the key: it uses the first 100
characters that come after the closing bracket of "[query]", which are never
unique.

Here is a patch that causes it to use the "sql" (e.g. "select * from ...") as
the unique message.

Here is an example of how to reproduce the problem:

[query ml="5" more=1 type=list
       sql="select * from products where prod_group = 'Hand Tools'"
]
    [on-match] [more-list] [more] [/more-list] <br> [/on-match]
    [list] [sql-param sku]<br> [/list]
[/query]

This will be used as the message:

    "[on-match] [more-list] [more] [/more-list] <br> [/on-match]
    [list] [sql-param sku]<br> [/li"

Whereas for a normal search (e.g. [loop]), it would use something like this:

   scan/fi=products/sf=prod_group/op=eq/se=Hand%20Tools/st=db/ml=5

Apparently, $page is whatever comes after [query], and that is never unique for
each query.  I have confirmed this bug in 4.9.9, 5.2.0, and CVS 2004-10-26.

Revision  Changes    Path
2.225     +3 -3      interchange/lib/Vend/Interpolate.pm


rev 2.225, prev_rev 2.224
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.224
retrieving revision 2.225
diff -u -r2.224 -r2.225
--- Interpolate.pm	19 Oct 2004 10:03:50 -0000	2.224
+++ Interpolate.pm	29 Oct 2004 05:02:01 -0000	2.225
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.224 2004/10/19 10:03:50 docelic Exp $
+# $Id: Interpolate.pm,v 2.225 2004/10/29 05:02:01 danb Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.224 $, 10);
+$VERSION = substr(q$Revision: 2.225 $, 10);
 
 @EXPORT = qw (
 
@@ -4547,7 +4547,7 @@
 		$obj->{mv_matchlimit} = $opt->{ml};
 		$obj->{mv_more_decade} = $opt->{md};
 		$obj->{matches} = scalar @{$obj->{mv_results}};
-		$obj->{mv_cache_key} = generate_key(substr($page,0,100));
+		$obj->{mv_cache_key} = generate_key($opt->{query} || substr($page,0,100));
 		$obj->{mv_first_match} = $opt->{fm} if $opt->{fm};
 		$obj->{mv_search_page} = $opt->{sp} if $opt->{sp};
 		$obj->{prefix} = $opt->{prefix} if $opt->{prefix};








More information about the interchange-cvs mailing list