[ic] accessing search results using perl in results.html

Mike Heins interchange-users@icdevgroup.org
Mon Dec 16 07:23:01 2002


Quoting Brent Kelly (brent@zeald.com):
> Hi,
> 
> I've been perusing through the maillist archives and haven't managed to 
> find any posts which specify how one can access the search results 
> directly in a perl block.  The best i've managed to do is retrieve the 
> number of results returned through $Search->{mv_results}.
> 
> What i'm actually hoping for is access to some array or has of returned 
> skus or something of the sort which will allow me to manipulate and 
> display them through perl without having to use the [search-region] or 
> -list tags.
> 
> Is there a simple(ish) way of doing this or is it even possible? Also 
> does anyone know of any docs on the subject?
> 

Yes, you can do it pretty easily.

[page search="
          sp=@@MV_PAGE@@
          ml=25
          sf=category
          se=Brushes
          rf=sku,description,price
          "]Search with 25 matchlimit</A>

[page search="
          sp=@@MV_PAGE@@
          ml=5
          sf=category
          se=Brushes
          rf=sku,description,price
          "]Search with 5 matchlimit</A>

<p>

<xmp>
[perl]
    my $obj = $Search->{''};
    return unless $obj;

    my $ary = $obj->{mv_results};
    my $ml = $obj->{mv_matchlimit};
    return "received (matchlimit=$ml) results: " . $Tag->uneval( { ref => $ary } );
[/perl]
</xmp>

You can also set a label and save it in a named area.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Fast, reliable, cheap.  Pick two and we'll talk.  -- unknown