Currently on my item browse pages I have an image gallery that shows 5 randomly selected featured images. If I am viewing the items in a specific collection the gallery only displays images limited to that collection. I created a custom function to create this gallery, the relevant portion is posted below:
function display_random_featured_item_gallery()
{
$html = '<div id="featured-gallery" class="galleryview"><ul class="gallery">';
//this creates an array of the featured items limited by collection
if ($collection = get_collection_by_id($_GET['collection'])) {
$limiter .= $collection->id;
$items = get_items(array('featured'=>true, 'collection'=>$limiter),100);
shuffle($items);
$subset = array_chunk($items,5);
set_items_for_loop($subset[0]);
}
//This creates an array of featured items
else{
$items = custom_get_random_featured_items('5');
set_items_for_loop($items); }
//The rest is just the image gallery info....
However, I can't seem to figure out how to limit the gallery based on tags or search strings. It would be cool if I searched for a specific topic, the image gallery would only show featured items with the topic.

