## Script (Python) "find_topics_window_supporter"
##bind container=container
##bind context=context
##bind namespace=ns
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
request = ns['request']

if not request.get('perform_search', False) and not request.get('SearchableText'):
    return []

kw = {'meta_type':'Topic'}

if request.get('topicTypes') and request.topicTypes != ['dummy']:
    kw['topicTypes'] = request.get('topicTypes')
if request.get('SearchableText'):
    kw['SearchableText'] = request.get('SearchableText')

return context.portal_catalog(**kw)
    
