def wsearch(args): """Search the whoosh index for provided terms.""" query = ' '.join(args) ids = search(config, query) for result in ids: bag, title = result['id'].split(':') print "%s:%s" % (bag, title)
def whoosh_search(environ): """ Handle incoming /search?q=<query> and return the found tiddlers. """ search_query = query_dict_to_search_string( environ['tiddlyweb.query']) or '' results = search(environ['tiddlyweb.config'], search_query) tiddlers = [] for result in results: bag, title = result['id'].split(':', 1) tiddler = Tiddler(title, bag) tiddlers.append(tiddler) return tiddlers