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)
def search(): searcher = Searcher(request.args) searcher.add_facet('schemata.name', 20) pager = Pager(searcher, 'search') #list(pager) schemata_facet = facet_schema_list(Entity, searcher.get_facet('schemata.name')) relschema_facet = facet_schema_list(Relation, searcher.get_facet('relations.schema.name')) return render_template('search.html', searcher=searcher, pager=pager, schemata_facet=schemata_facet, relschema_facet=relschema_facet)
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)
def index(): searcher = Searcher(request.args) searcher.add_facet('schemata.name', 20) schemata_facet = facet_schema_list(Entity, searcher.get_facet('schemata.name')) return render_template('index.html', schemata_facet=schemata_facet)