Class SearchResultResource

java.lang.Object
io.goobi.viewer.api.rest.v1.search.SearchResultResource

@Path("/search") public class SearchResultResource extends Object
REST resource for exporting search results in OpenSearch and RIS bibliographic formats.
  • Constructor Details

  • 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-less buildFinalQuery overload (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. sortString is 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 a Content-Disposition attachment 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 string
      sortString - the sort string for the search results
      activeFacetString - the active facet filter string
      proximitySearchDistance - the maximum word distance for proximity search
      Returns:
      an empty Response with status 200
      Throws:
      PresentationException - if the Solr search fails
      IndexUnreachableException - if the Solr index is unreachable
      DAOException - if license types cannot be loaded for access filtering
      de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException - if the temporary RIS export file cannot be written
      ViewerConfigurationException - 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 string
      activeFacetString - the active facet filter string
      rows - maximum number of results to return (default 100)
      Returns:
      a Response containing the Solr XML
      Throws:
      PresentationException - if the query cannot be parsed
      IndexUnreachableException - if the Solr index is unreachable
      DAOException - 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. The format path parameter is matched against the name attribute of <format> elements in config_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 string
      sortString - the sort order string (used by field-mapped formats)
      activeFacetString - the active facet filter string
      proximitySearchDistance - 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 Response with the export content