示例#1
0
文件: views.py 项目: aburgm/adsabs
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()
示例#2
0
文件: views.py 项目: aburgm/adsabs
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
示例#3
0
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()