#set ($catalogid = $context.getRequestParameter('catalogid'))
#set ($searchtype = $context.getRequestParameter('searchtype')) ##product
#set ($fieldname = $context.getRequestParameter('fieldname')) ##lastmodified
#set ($view = $context.getRequestParameter('view'))
#set ($update = $context.getRequestParameter("update"))
#set($originalsearcher = $searcherManager.getSearcher($catalogid, $searchtype))
#if(!$detail) ##this is new. To reduce complexity we want to just load up the detail all the time
#set( $detail = $originalsearcher.getDetailForView($view, $fieldname, $user) )
#end
#set($listid = $detail.getListId())
#set($csslistid = "bootstraplist-$!detailprefix${detail.id}")
#set($lsearcher = $searcherManager.getSearcher( $detail.getListCatalogId(), $listid ))
#set ($foreignkeyid = $detail.get("foreignkeyid") )
#set ($foreignkeyvalue = $context.getRequestParameter('foreignkeyvalue'))
#set ($squery = $detail.query )
#if ($foreignkeyid && $foreignkeyvalue)
#set( $foreigndetail = $originalsearcher.getDetailForView($view, $foreignkeyid, $user) )
#if( $foreigndetail && $foreigndetail.listid )
#set( $foreignfield = $foreigndetail.listid )
#else
#set( $foreignfield = $foreignkeyid )
#end
#set ($query = $lsearcher.createSearchQuery())
#set ($o = $query.setAndTogether(false))
#set ($o = $query.addMatches("$foreignfield", "$foreignkeyvalue"))
#elseif( $squery && (!$detail.getType() || $detail.getType() != "textjoin") )
#set ($query = $lsearcher.parse($squery))
#else
#set ($query = $lsearcher.createSearchQuery())
#set ($o = $query.addMatches("id", "*"))
#end
#if ($detail.sort)
$query.setSortBy($detail.sort)
#end
$lsearcher.addShowOnly($context, $query)
#set($types = $lsearcher.search($context, $query))
#if(!$value)
#set($value = $context.getRequestParameter('value'))
#end
#set($valueid = "$fieldname")
#if($types)
#if($foreignkeyid)
#end
#if( $caneditlists && "$caneditlists" == "true")
#end
#if( $caneditlists && "$caneditlists" == "true")
#end
#else
No values found in data file ${listid}.xml
#end
#if( $caneditlists && "$caneditlists" == "true")
#end
#if($update == true)
#else
#end