コード例 #1
0
ファイル: facets.py プロジェクト: backgroundcheck/aleph
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
ファイル: sources_api.py プロジェクト: stefanw/aleph
def index():
    q = Source.all_by_ids(ids=authz.sources(authz.READ))
    return jsonify(Pager(q))