Skip to content

Commit

Permalink
Merge pull request #13 from NASA-PDS/i12
Browse files Browse the repository at this point in the history
Fix SEARCH/ACCESS issue for LIDVID resource references
  • Loading branch information
jordanpadams authored Oct 13, 2023
2 parents 2be5aaa + 708d232 commit 5fb6519
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<groupId>gov.nasa.pds.2010.portal</groupId>
<artifactId>ds-view</artifactId>
<version>2.14.2</version>
<version>2.14.3</version>
<packaging>war</packaging>

<name>Data Set View</name>
Expand Down
22 changes: 15 additions & 7 deletions src/main/java/gov/nasa/pds/dsview/registry/PDS4Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public SolrDocument getContext(String identifier) throws SolrServerException, IO
HttpSolrClient solr = new HttpSolrClient.Builder(solrServerUrl).build();
ModifiableSolrParams params = new ModifiableSolrParams();

params.add("q", "identifier:" + cleanIdentifier(identifier));
params.add("q", "identifier:" + cleanIdentifier(identifier));
params.set("indent", "on");
params.set("wt", "xml");

Expand Down Expand Up @@ -271,7 +271,8 @@ public Map<String, String> getResourceLinks(List<String> resourceRefList)
}

for (String resourceRef : resourceRefList) {
params.add("q", "identifier:" + cleanIdentifier(resourceRef));
params.clear();
params.add("q", "identifier:" + cleanIdentifier(getLID(resourceRef)));
params.set("indent", "on");
params.set("wt", "xml");

Expand All @@ -288,7 +289,6 @@ public Map<String, String> getResourceLinks(List<String> resourceRefList)
while (itr.hasNext()) {
doc = itr.next();
log.info("***************** idx = " + (idx++));
// log.info(doc.toString());

String resourceName = "";
String resourceURL = "";
Expand Down Expand Up @@ -375,10 +375,18 @@ else if (doiResponse.length() == 1) {
}
}
}

private String cleanIdentifier(String identifier) {
return identifier.replace(":", "\\:").replace("\\\\", "\\");
}

private String cleanIdentifier(String identifier) {
return identifier.replace(":", "\\:").replace("\\\\", "\\");
}

private String getLID(String identifier) {
if (identifier.contains("::")) {
return identifier.substring(0, identifier.indexOf("::"));
}

return identifier;
}

/**
* Command line invocation.
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- Search Service base URL -->
<context-param>
<param-name>search.url</param-name>
<param-value>http://localhost:8983/solr/data</param-value>
<param-value>http://localhost:8080/search-service</param-value>
</context-param>

<!-- DOI Service base URL -->
Expand Down

0 comments on commit 5fb6519

Please sign in to comment.