[ic] SQL + search_region

Mike Heins mike at perusion.com
Mon May 24 14:33:38 EDT 2004

Quoting Jamie Neil (jamie at versado.net):
> Hi all,
> We're currently using action maps to strip arguments out of a string like:
>   http://www.widgets.com/dept/sprockets/red/acme.html
> , turning them into an IC search and then using a search_region page to 
> display the results.
> This works OK up to a point, but for complex searches the action map 
> starts to get a bit unweildy as we hit the limits of the built in IC 
> search system.
> So for complex searches we now use direct sql queries which are faster 
> and much more flexible. However because they are embedded in the results 
> page, it makes maintainance more difficult.
> Does anyone know if it's possible to get the best of both worlds and use 
> a _real_ sql query to display results in a search_region page?

That is a pretty big question. If it were soluable outside of allowing
arbitrary SQL queries inputted by forms, I think someone might have
done it to this point.

The problem with complex searches is that they *are* complex. Someone
has to deal with the complexity somewhere; and if they don't deal with
it in the way you want you have to deal with it yourself.

If you can articulate this a bit better, maybe someone can help.

Sounds like mostly you want to pre-do the search with SQL, and
then display it with the search-region. This can easily be done
by formatting a $Search->{labelname} object, then passing it
on with [search-region label=labelname]. I believe you want
to have at least:

	my $ary = [ [ 'return1', 'return2', ] ];
	my $n = scalar @$ary;
	$Search->{$label} = {
		matches => $n,
		mv_results => $ary,
		mv_matchlimit => 20,
		mv_field_names => [ 'field1', 'field2', ],

Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

People who want to share their religious views with you
almost never want you to share yours with them. -- Dave Barry

More information about the interchange-users mailing list