示例#1
0
def convert_sources(facet):
    output = {'values': []}
    ids = [b.get('key') for b in facet.get('buckets', [])]
    sources = Source.all_by_ids(ids).all()
    for bucket in facet.get('buckets', []):
        key = bucket.get('key')
        for source in sources:
            if source.id != key:
                continue
            output['values'].append({
                'id': key,
                'label': source.label,
                'category': source.category,
                'count': bucket.get('doc_count')
            })
    return output
示例#2
0
文件: sources_api.py 项目: 01-/aleph
def index():
    q = Source.all_by_ids(ids=authz.sources(authz.READ))
    return jsonify(Pager(q))
示例#3
0
def index():
    q = Source.all_by_ids(ids=authz.sources(authz.READ))
    return jsonify(Pager(q))