def search(request): """Search the database for annotations matching with the given query.""" schema = SearchParamsSchema() params = validate_query_params(schema, request.params) separate_replies = params.pop("_separate_replies", False) stats = getattr(request, "stats", None) search = search_lib.Search(request, separate_replies=separate_replies, stats=stats) result = search.run(params) svc = request.find_service(name="annotation_json_presentation") out = { "total": result.total, "rows": svc.present_all(result.annotation_ids) } if separate_replies: out["replies"] = svc.present_all(result.reply_ids) return out
def search(request): """Search the database for annotations matching with the given query.""" schema = SearchParamsSchema() params = validate_query_params(schema, request.params) _record_search_api_usage_metrics(params) separate_replies = params.pop('_separate_replies', False) stats = getattr(request, 'stats', None) search = search_lib.Search(request, separate_replies=separate_replies, stats=stats) search.append_modifier( UriCombinedWildcardFilter(request, separate_keys=True)) result = search.run(params) svc = request.find_service(name='annotation_json_presentation') out = { 'total': result.total, 'rows': svc.present_all(result.annotation_ids) } if separate_replies: out['replies'] = svc.present_all(result.reply_ids) return out
def schema(self): return SearchParamsSchema()