Commit dd030eca by Suma Shivaprasad

ATLAS-1088 Fix /search api to default to fulltext on dsl failure (sumasai)

parent a165234c
......@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ALL CHANGES:
ATLAS-1088 Fix /search api to default to fulltext on dsl failure (sumasai)
ATLAS-762 Assertion in NegativeSSLAndKerberosTest.testUnsecuredClient needs to be hardened (nixonrodrigues via sumasai)
ATLAS-1071 Regression - UI - Details Button under Audits Tab is not working.(kevalbhatt18 via sumasai)
ATLAS-965 Old lineage still exists after dropping tables and re-creating tables with same name. (shwethags via sumasai)
......
......@@ -93,8 +93,20 @@ public class MetadataDiscoveryResource {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "MetadataDiscoveryResource.search(" + query + ", " + limit + ", " + offset + ")");
}
Response response = searchUsingQueryDSL(query, limit, offset);
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
boolean dslQueryFailed = false;
Response response = null;
try {
response = searchUsingQueryDSL(query, limit, offset);
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
dslQueryFailed = true;
}
} catch (Exception e) {
LOG.debug("Error while running DSL. Switching to fulltext for query {}", query, e);
dslQueryFailed = true;
}
if ( dslQueryFailed ) {
response = searchUsingFullText(query, limit, offset);
}
AtlasPerfTracer.log(perf);
......
......@@ -196,6 +196,25 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT {
assertEquals(response.getString("queryType"), "dsl");
}
@Test
public void testSearchFullTextOnDSLFailure() throws Exception {
String query = "*";
WebResource resource = service.path("api/atlas/discovery/search").queryParam("query", query);
ClientResponse clientResponse = resource.accept(Servlets.JSON_MEDIA_TYPE).type(Servlets.JSON_MEDIA_TYPE)
.method(HttpMethod.GET, ClientResponse.class);
assertEquals(clientResponse.getStatus(), Response.Status.OK.getStatusCode());
String responseAsString = clientResponse.getEntity(String.class);
Assert.assertNotNull(responseAsString);
JSONObject response = new JSONObject(responseAsString);
Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
assertEquals(response.getString("query"), query);
assertEquals(response.getString("queryType"), "full-text");
}
@Test(dependsOnMethods = "testSearchDSLLimits")
public void testSearchUsingFullText() throws Exception {
JSONObject response = serviceClient.searchByFullText(tagName, 10, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment