Commit 6bacbe94 by nixonrodrigues Committed by Madhan Neethiraj

ATLAS-2673: Decode query string for DSL search

parent e4ffcf24
......@@ -463,6 +463,9 @@ public class QuickStartV2 {
return new String[]{
"from DB",
"DB",
"DB where name=%22Reporting%22",
"DB where name=%22encode_db_name%22",
"Table where name=%2522sales_fact%2522",
"DB where name=\"Reporting\"",
"DB where DB.name=\"Reporting\"",
"DB name = \"Reporting\"",
......@@ -519,6 +522,8 @@ public class QuickStartV2 {
System.out.println("query [" + dslQuery + "] returned [" + fullTextResults.size() + "] rows.");
} else if (attribResult != null) {
System.out.println("query [" + dslQuery + "] returned [" + attribResult.getValues().size() + "] rows.");
} else {
System.out.println("query [" + dslQuery + "] returned [ 0 ] rows.");
}
} else {
System.out.println("query [" + dslQuery + "] failed, results:" + results);
......
......@@ -112,6 +112,9 @@ public class DiscoveryREST {
AtlasPerfTracer perf = null;
try {
query = Servlets.decodeQueryString(query);
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.searchUsingDSL(" + query + "," + typeName
+ "," + classification + "," + limit + "," + offset + ")");
......
......@@ -40,10 +40,12 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.util.UriUtils;
/**
* Utility functions for dealing with servlets.
......@@ -211,4 +213,13 @@ public final class Servlets {
throw new AtlasBaseException(AtlasErrorCode.INVALID_QUERY_PARAM_LENGTH, paramName);
}
}
public static String decodeQueryString(String query){
try {
return UriUtils.decode(query,"UTF-8");
} catch (UnsupportedEncodingException e){
return query;
}
}
}
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