# $Id$ # $URL$ import searchform, resultlist, drilldown websiteConfig = configs['website'] logger = logging.getLogger('meresco.search') logger.debug("Starting logger") def main(headers={}, arguments={}, *args, **kwargs): query = '' httpQuery = '' if ('query' in (arguments)): query = arguments.get('query', [''])[0] httpQuery = arguments.get('query', [''])[0] httpQuery = escapeHtml(httpQuery) messageOfTheDay = websiteConfig.get('messageOfTheDay', section = 'userFeedback') sortBy = sortDescending = None sortKeys = arguments.get('sortKeys', [''])[0] if not sortKeys: sortKeys = any.configuration().get('defaultSortKeys', None) if sortKeys: sortBy, ignored, sortDescending = sortKeys.split(',') sortDescending = sortDescending == '1' drilldownArguments = arguments.get('drilldown', []) extra = arguments.get('extra', []) ### parsetree wordt doorgegeven aan search engine via de call executeCQL ### cqlQuery is de serialisatie die gebruikt wordt voor RSS # logger.debug('httpQuery: '+httpQuery) # logger.debug('drilldownArguments:\n' + prpt.pformat(drilldownArguments)) parsetree, cqlQuery = any.parseQuery(query, drilldownArguments, extra) t0 = time() offset = int(arguments.get('offset', ['0'])[0]) ### De start en stop argumenten bepalen het begin en eind record welke worden teruggegeven. ### De +10 in de stop is dus de batchgrootte. total, recordIds = any.executeCQL(cqlAbstractSyntaxTree=parsetree, start=offset, stop=offset+10, sortBy=sortBy, sortDescending=sortDescending) docset = any.docsetFromQuery(cqlAbstractSyntaxTree=parsetree) duration = time() - t0 ### Drilldown yield """
""" yield """
%s
""" %messageOfTheDay ### RSS rssLink = '%s/rss?%s' % (any.configuration().get('baseURL', ''), urlencode({'query': cqlQuery})) yield """
""" % rssLink rssImage = '/files/' + websiteConfig.get('rss', section='images') yield 'rss' % (rssLink,rssImage) yield """
""" yield searchform.main(arguments=arguments, *args, **kwargs) ### Results yield """
""" # yield resultlist.main(total=total, recordIds=recordIds, docset=docset, duration=duration, cqlQuery=cqlQuery, httpQuery=httpQuery, arguments=arguments, *args, **kwargs) yield resultlist.main(total=total, recordIds=recordIds, docset=docset, duration=duration, cqlQuery=cqlQuery, httpQuery= httpQuery, arguments=arguments, *args, **kwargs) yield """
"""