[ic] [query] causes [more] to generate non-unique mv_cache_key

Daniel Browning db at kavod.com
Tue Oct 26 21:59:15 EDT 2004

This bug has subtle but important effects for anyone using [query] & [more].

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

Here is a patch that causes it to use the "sql" (e.g. "select * from ...") as
the unique message.  It works for me -- what do you think about it?  Otherwise,
I think our only option is nothing, i.e. time().


+++ Interpolate.pm      2004-10-26 18:50:25.643328006 -0700
@@ -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(substr($opt->{query} || $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};

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]

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:

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.
Daniel Browning <db at kavod.com> - Kavod Technologies.  Random Fortune:
Youth is a disease from which we all recover.
		-- Dorothy Fuldheim

More information about the interchange-users mailing list