Skip to content

Commit 13573ea

Browse files
committed
Changes per review
1 parent 27d9f86 commit 13573ea

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

doc/release-notes/11281-ExternalSearch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ An additional /api/search/engines endpoint allows discovery of the engines insta
88
In addition to two trivial example engines designed for testing, Dataverse ships with two search engine classes that support calling an enternally-hosted search service (via HTTP GET or POST).
99
These classes rely on the internal solr search to perform access-control and to format the final results, simplifying development of such an external engine.
1010

11-
Details about the new functionality are described in
11+
Details about the new functionality are described in https://guides.dataverse.org/en/latest/developers/search-services.html

doc/sphinx-guides/source/developers/search-services.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The ``SearchService`` interface is the core of the configurable search services.
2828
default void setSolrSearchService(SearchService solrSearchService);
2929
}
3030
31-
The interface allows you to provide a service name and dsiplay name, and to respond to the same search parameters that are normally sent to the solr search engine.
31+
The interface allows you to provide a service name and display name, and to respond to the same search parameters that are normally sent to the solr search engine.
3232

3333
The setSolrSearchService method is used by Dataverse to give your class a reference to the SolrSearchService, allowing your class to perform solr queries as needed. (See the ExternalSearchServices for an example.)
3434

src/main/java/edu/harvard/iq/dataverse/search/GetExternalSearchServiceBean.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ public SolrQueryResponse search(DataverseRequest dataverseRequest, List<Datavers
5656
filterQueries, addHighlights, addFacets, onlyDataRelatedToMe, retrieveEntities, geoPoint, geoRadius);
5757

5858
// Send GET request to external service
59-
Client client = ClientBuilder.newClient();
60-
Response response = client.target(externalSearchUrl).queryParam("params", queryParams)
61-
.request(MediaType.APPLICATION_JSON).get();
59+
try (Client client = ClientBuilder.newClient()) {
60+
Response response = client.target(externalSearchUrl).queryParam("params", queryParams)
61+
.request(MediaType.APPLICATION_JSON).get();
62+
63+
if (response.getStatus() != 200) {
64+
throw new SearchException("External search service returned status " + response.getStatus(), null);
65+
}
6266

63-
if (response.getStatus() != 200) {
64-
throw new SearchException("External search service returned status " + response.getStatus(), null);
65-
}
66-
try {
6767
// Parse response and process results
6868
String responseString = response.readEntity(String.class);
6969
logger.finest("External search returned: " + responseString);

0 commit comments

Comments
 (0)