def search(): search_req = ApiSearchRequest(request.args) if not search_req.validate(): statsd.incr("api.search.invalid") raise api_errors.ApiInvalidRequest(search_req.input_errors()) resp = search_req.execute() statsd.incr("api.search.success") return resp.search_response()
def search_metrics(): search_req = ApiSearchRequest(request.args) if not search_req.validate(): statsd.incr("api.search_metrics.invalid") raise api_errors.ApiInvalidRequest(search_req.input_errors()) resp = search_req.execute() search_response = resp.search_response() bibcodes = map(lambda a: a['bibcode'], filter(lambda a: 'bibcode' in a, search_response['results']['docs'])) metrics = generate_metrics(bibcodes=bibcodes, fmt='API') search_response['results'] = metrics statsd.incr("api.search_metrics.success") return search_response
def search(): search_req = ApiSearchRequest(request.args) if not search_req.validate(): raise api_errors.ApiInvalidRequest(search_req.input_errors()) resp = search_req.execute() return resp.search_response()