$def with(query, results, page=1)
$def render_snippet(query, doc):
$if results and results.get('hits'):
$ hits = results['hits'].get('hits', [])
$ num_found = results['hits'].get('total', 0)
$for doc in hits:
$if doc.get('edition'):
$:macros.SearchResultsWork(doc['edition'], availability=doc['availability'], extra=render_snippet(query, doc))
$:macros.Pager(page, num_found)