@ GET @ Path ( "search/dsl" ) @ Consumes ( Servlets . JSON_MEDIA_TYPE ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public Response searchUsingQueryDSL ( @ QueryParam ( "query" ) String dslQuery , @ DefaultValue ( LIMIT_OFFSET_DEFAULT ) @ QueryParam ( "limit" ) int limit , @ DefaultValue ( LIMIT_OFFSET_DEFAULT ) @ QueryParam ( "offset" ) int offset ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> MetadataDiscoveryResource.searchUsingQueryDSL({}, {}, {})" , dslQuery , limit , offset ) ; } AtlasPerfTracer perf = null ; try { if ( AtlasPerfTracer . isPerfTraceEnabled ( PERF_LOG ) ) { perf = AtlasPerfTracer . getPerfTracer ( PERF_LOG , "MetadataDiscoveryResource.searchUsingQueryDSL(" + dslQuery + ", " + limit + ", " + offset + ")" ) ; } dslQuery = ParamChecker . notEmpty ( dslQuery , "dslQuery cannot be null" ) ; QueryParams queryParams = validateQueryParams ( limit , offset ) ; final String jsonResultStr = discoveryService . searchByDSL ( dslQuery , queryParams ) ; JSONObject response = new DSLJSONResponseBuilder ( ) . results ( jsonResultStr ) . query ( dslQuery ) . build ( ) ; return Response . ok ( response ) . build ( ) ; } catch ( DiscoveryException | IllegalArgumentException e ) { LOG . error ( "Unable to get entity list for dslQuery {}" , dslQuery , e ) ; throw new WebApplicationException ( Servlets . getErrorResponse ( e , Response . Status . BAD_REQUEST ) ) ; } catch ( WebApplicationException e ) { LOG . error ( "Unable to get entity list for dslQuery {}" , dslQuery , e ) ; throw e ; } catch ( Throwable e ) { LOG . error ( "Unable to get entity list for dslQuery {}" , dslQuery , e ) ; throw new WebApplicationException ( Servlets . getErrorResponse ( e , Response . Status . INTERNAL_SERVER_ERROR ) ) ; } finally { AtlasPerfTracer . log ( perf ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "<== MetadataDiscoveryResource.searchUsingQueryDSL({}, {}, {})" , dslQuery , limit , offset ) ; } } }
Search using query DSL format .