def index(): now = datetime.now() context = helpers.build_search_context() r = helpers.maybe_search_redirect(context["search"]) if r: return r request_log = RequestLog.get(id=g.request_log_id) r, n_results = helpers.maybe_domain_search(context) if r: sl = SearchLog(request_log=request_log, context=context, is_json=False, created_at=now, results=n_results) return r r, n_results = helpers.render_elasticsearch(context) sl = SearchLog(request_log=request_log, context=context, is_json=False, created_at=now, results=n_results) return r
def index_json(): context = helpers.build_search_context() request_log = RequestLog.get(id=g.request_log_id) r, n_results = helpers.maybe_domain_search(context, json=True) if r: sl = SearchLog(request_log=request_log, context=context, is_json=True, created_at=now, results=n_results) return r r, n_results = helpers.render_elasticsearch(context, json=True) sl = SearchLog(request_log=request_log, context=context, is_json=True, created_at=now, results=n_results) return r