Class SearchResultResource
-
Constructor Summary
ConstructorsConstructorDescriptionSearchResultResource(HttpServletRequest servletRequest, HttpServletResponse servletResponse) -
Method Summary
Modifier and TypeMethodDescriptiongetRISAsFile(String query, String sortString, String activeFacetString, int proximitySearchDistance) Executes the given search and prepares its hits as a RIS bibliographic export.getSearchResultsAsFormat(String format, String query, String sortString, String activeFacetString, int proximitySearchDistance, int rows, String identifier) Generic, config-driven export endpoint for search results.getSearchResultsAsXml(String query, String activeFacetString, int rows) Exports the current search results as raw Solr-style XML.
-
Constructor Details
-
SearchResultResource
public SearchResultResource() -
SearchResultResource
-
-
Method Details
-
getRISAsFile
@GET @Path("/ris") @Produces("text/plain") public Response getRISAsFile(@QueryParam("query") @DefaultValue("") String query, @QueryParam("sortString") @DefaultValue("") String sortString, @QueryParam("activeFacetString") @DefaultValue("") String activeFacetString, @QueryParam("proximitySearchDistance") @DefaultValue("0") int proximitySearchDistance) throws PresentationException, IndexUnreachableException, DAOException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException, ViewerConfigurationException Executes the given search and prepares its hits as a RIS bibliographic export.The query is built via
SearchHelper.prepareQuery(java.lang.String)and the request-lessbuildFinalQueryoverload (aggregated to the top-level document structure). Unlike the other search exports in this resource, this operation does not apply the download-metadata access restriction.sortStringis currently unused: the export always runs in Solr's default hit order. When the search has results,RisResourceBuilder.writeRIS(java.util.List<io.goobi.viewer.model.search.SearchHit>)sets aContent-Dispositionattachment header on the response and writes the RIS records to a server-side temporary file, but the returned streaming handle is never consumed here, so the response carries no RIS content and the temporary file is never removed either.- Parameters:
query- the search query stringsortString- the sort string for the search resultsactiveFacetString- the active facet filter stringproximitySearchDistance- the maximum word distance for proximity search- Returns:
- an empty
Responsewith status 200 - Throws:
PresentationException- if the Solr search failsIndexUnreachableException- if the Solr index is unreachableDAOException- if license types cannot be loaded for access filteringde.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException- if the temporary RIS export file cannot be writtenViewerConfigurationException- if the viewer configuration needed to build the search hits cannot be read
-
getSearchResultsAsXml
@GET @Path("/export/xml") @Produces("application/xml") public Response getSearchResultsAsXml(@QueryParam("query") @DefaultValue("*:*") String query, @QueryParam("activeFacetString") @DefaultValue("") String activeFacetString, @QueryParam("rows") @DefaultValue("100") int rows) throws PresentationException, IndexUnreachableException, DAOException Exports the current search results as raw Solr-style XML.- Parameters:
query- the Solr search query stringactiveFacetString- the active facet filter stringrows- maximum number of results to return (default 100)- Returns:
- a
Responsecontaining the Solr XML - Throws:
PresentationException- if the query cannot be parsedIndexUnreachableException- if the Solr index is unreachableDAOException- if license types cannot be loaded for access filtering
-
getSearchResultsAsFormat
@GET @Path("/export/{format}") public Response getSearchResultsAsFormat(@PathParam("format") String format, @QueryParam("query") @DefaultValue("*:*") String query, @QueryParam("sortString") @DefaultValue("") String sortString, @QueryParam("activeFacetString") @DefaultValue("") String activeFacetString, @QueryParam("proximitySearchDistance") @DefaultValue("0") int proximitySearchDistance, @QueryParam("rows") @DefaultValue("100") int rows, @QueryParam("identifier") @DefaultValue("") String identifier) Generic, config-driven export endpoint for search results. Theformatpath parameter is matched against thenameattribute of<format>elements inconfig_viewer.xml. Both XSLT-based formats (ris/endnote/bibtex) and Java field-mapped formats (excel/csv) are served here.Unknown formats return 404, disabled formats return 403. Generation runs on a background thread bounded by the shared export timeout, and the request blocks until the result is ready or the timeout elapses; a plain executor (not servlet/JAX-RS async) is used, so this does not require the servlet filter chain to support asynchronous processing.
- Parameters:
format- the export format name (e.g. "endnote", "bibtex", "ris", "excel", "csv")query- the Solr search query stringsortString- the sort order string (used by field-mapped formats)activeFacetString- the active facet filter stringproximitySearchDistance- maximum word distance for proximity search (used by field-mapped formats)rows- maximum number of results for XSLT formats (default 100; field-mapped formats always export all hits)- Returns:
- a
Responsewith the export content
-