Skip to content

Commit

Permalink
Revert code changes to 'findDataPids' method to last working state
Browse files Browse the repository at this point in the history
  • Loading branch information
doulikecookiedough committed Oct 28, 2024
1 parent 6a9ac1d commit 009db3d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/edu/ucsb/nceas/mdqengine/MDQEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,10 @@ public ArrayList<String> findDataPids(NodeReference nodeId, String identifier) t
// String together the solr query URL to grab the data pids
String nodeEndpoint = D1Client.getMN(nodeId).getNodeBaseServiceUrl();
// The quotations wrapping the identifier are necessary for solr to parse the request
String valueToEncode = "\"" + identifier + "\"";
String encodedId = URLEncoder.encode(valueToEncode, "UTF-8");
String queryUrl = nodeEndpoint + "/query/solr/?q=isDocumentedBy:" + encodedId + "&fl=id";
String encodedId = URLEncoder.encode(identifier, "UTF-8");
String encodedQuotes = URLEncoder.encode("\"", "UTF-8");
// String queryUrl = nodeEndpoint + "/query/solr/?q=isDocumentedBy:" + "\"" + encodedId + "\"" + "&fl=id";
String queryUrl = nodeEndpoint + "/query/solr/?q=isDocumentedBy:" + encodedQuotes + encodedId + encodedQuotes + "&fl=id";
log.debug("queryURL: " + queryUrl);

URL url = new URL(queryUrl);
Expand All @@ -274,7 +275,7 @@ public ArrayList<String> findDataPids(NodeReference nodeId, String identifier) t
}

if (connection.getResponseCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + connection.getResponseCode() + connection.getResponseMessage());
throw new RuntimeException("Failed : HTTP error code : " + connection.getResponseCode());
}

InputStream xml = connection.getInputStream();
Expand Down

0 comments on commit 009db3d

Please sign in to comment.