Class IndexStatisticsResource
java.lang.Object
io.goobi.viewer.api.rest.v1.statistics.index.IndexStatisticsResource
Index-level statistics for the new Chart.js-driven CMS components. All endpoints emit JSON; the JAX-RS/Jersey stack
registers this class via package scanning (
io.goobi.viewer.api.rest.v1.*). Public access (no
@AuthorizationBinding) — see Phase 1 design notes in plan #15809.
Each endpoint translates StatisticsUnavailableException (raised by IndexStatisticsService when Solr
is unreachable AND no cached snapshot is available) to HTTP 503 with a small JSON error body, so the frontend can
differentiate "really down" from "empty result". On success the response carries
Cache-Control: public, max-age=3600; the service layer keeps an additional day-long internal cache.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetImportSummary(String filter) Total page and full-text counts in the index.getImportTrend(int days, int buckets, String filter) Cumulative-count time-series of imported records for a line chart.getLanguages(String lang, String filter) Distribution of works by language with locale-translated labels.getPublicationCenturies(String filter) Histogram of works by publication century.getPublicationTypes(String lang, String filter) Lists each top-level docstruct type with its record count.getTopCollections(int size, String lang, String filter) Topsizecollections by record count, with locale-translated labels.
-
Constructor Details
-
IndexStatisticsResource
public IndexStatisticsResource()
-
-
Method Details
-
getPublicationTypes
@GET @Path("/publication-types") @Produces("application/json") public Response getPublicationTypes(@QueryParam("lang") String lang, @QueryParam("filter") String filter) Lists each top-level docstruct type with its record count.- Parameters:
lang- IETF BCP 47 language tag (e.g.de,en); typically supplied by the composite as#{navigationHelper.localeString}so the response matches the user's UI languagefilter- optional Lucene sub-query forwarded from the CMS-admin filter input; restricts the docstruct facet to a subset of the index. No validation here — the backend editor'ssolrQueryValidatorgate-keeps before persistence, and the service wraps the value in MUST so it can only narrow.- Returns:
- 200 + JSON list on success, 503 + JSON error body when the service signals unavailability
-
getImportTrend
@GET @Path("/import-trend") @Produces("application/json") public Response getImportTrend(@QueryParam("days") @DefaultValue("180") int days, @QueryParam("buckets") @DefaultValue("12") int buckets, @QueryParam("filter") String filter) Cumulative-count time-series of imported records for a line chart.- Parameters:
days- size of the look-back windowbuckets- number of data points to producefilter- optional Lucene sub-query forwarded from the CMS-admin filter input; restricts the time-series.- Returns:
- 200 + JSON list on success, 503 + JSON error body when the service signals unavailability
-
getImportSummary
@GET @Path("/imports-summary") @Produces("application/json") public Response getImportSummary(@QueryParam("filter") String filter) Total page and full-text counts in the index.- Parameters:
filter- optional Lucene sub-query forwarded from the CMS-admin filter input; applies to both counts.- Returns:
- 200 + JSON summary on success, 503 + JSON error body when the service signals unavailability
-
getPublicationCenturies
@GET @Path("/publication-centuries") @Produces("application/json") public Response getPublicationCenturies(@QueryParam("filter") String filter) Histogram of works by publication century.- Parameters:
filter- optional Lucene sub-query forwarded from the CMS-admin filter input.- Returns:
- 200 + JSON list on success, 503 + JSON error body when the service signals unavailability
-
getLanguages
@GET @Path("/languages") @Produces("application/json") public Response getLanguages(@QueryParam("lang") String lang, @QueryParam("filter") String filter) Distribution of works by language with locale-translated labels.- Parameters:
lang- IETF BCP 47 language tag for label translation; typically supplied by the composite as#{navigationHelper.localeString}.filter- optional Lucene sub-query forwarded from the CMS-admin filter input.- Returns:
- 200 + JSON list on success, 503 + JSON error body when the service signals unavailability
-
getTopCollections
@GET @Path("/top-collections") @Produces("application/json") public Response getTopCollections(@QueryParam("size") @DefaultValue("10") int size, @QueryParam("lang") String lang, @QueryParam("filter") String filter) Topsizecollections by record count, with locale-translated labels.- Parameters:
size- maximum number of collections to returnlang- IETF BCP 47 language tag for label translationfilter- optional Lucene sub-query forwarded from the CMS-admin filter input.- Returns:
- 200 + JSON list on success, 503 + JSON error body when the service signals unavailability
-