Esempio n. 1
0
def search():
    searcher = Searcher(request.args)
    if 'project' in request.args:
        searcher.add_filter('project.slug', request.args.get('project'))
    pager = Pager(searcher)
    
    def convert(serp):
        ents = Entity.by_id_many([r['id'] for r in serp], request.account)
        results = [ents.get(r['id']) for r in serp]
        results = [entities.to_rest_index(r) for r in results]
        return results

    data = pager.to_dict(results_converter=convert)
    data['facets'] = searcher.facets()
    return jsonify(data)
Esempio n. 2
0
def bodies():
    eu_bodies = Searcher(request.args,
        sort_field=('degree', 'desc'))
    eu_bodies.limit(200)
    eu_bodies.add_filter('schemata.name', 'eu_body')
    return render_template('bodies.html', eu_bodies=eu_bodies)