Class IIIFSearchBuilder
java.lang.Object
io.goobi.viewer.model.iiif.search.IIIFSearchBuilder
Creates a IIIF Search API v1.0 response as
SearchResult.- Author:
- Florian Alpers
-
Constructor Summary
ConstructorsConstructorDescriptionIIIFSearchBuilder(AbstractApiUrlManager urls, String query, String pi, HttpServletRequest request) Initializes the builder with all required parameters. -
Method Summary
Modifier and TypeMethodDescriptionde.intranda.api.iiif.search.SearchResultbuild()de.intranda.api.iiif.search.AutoSuggestResultgetDate()Getter for the fielddate.intGetter for the fieldhitsPerPage.getMin()Getter for the fieldmin.Getter for the fieldmotivation.intgetPage()Getter for the fieldpage.getPi()Getter for the fieldpi.getQuery()Getter for the fieldquery.getUser()Getter for the fielduser.Setter for the fielddate.setHitsPerPage(int hitsPerPage) Setter for the fieldhitsPerPage.Setter for the fieldmin.setMotivation(String motivation) Setter for the fieldmotivation.Setter for the fieldpage.Setter for the fielduser.
-
Constructor Details
-
IIIFSearchBuilder
public IIIFSearchBuilder(AbstractApiUrlManager urls, String query, String pi, HttpServletRequest request) Initializes the builder with all required parameters.- Parameters:
urls- the API URL manager for constructing resource URIsquery- the query stringpi- the pi of the manifest to searchrequest- the current HTTP servlet request
-
-
Method Details
-
getQuery
Getter for the fieldquery.- Returns:
- the search query string
-
getPi
Getter for the fieldpi.- Returns:
- the persistent identifier of the record to search within
-
setMotivation
Setter for the fieldmotivation.- Parameters:
motivation- space- or plus-separated list of IIIF motivation values to filter search results- Returns:
- this IIIFSearchBuilder instance for method chaining
-
getMotivation
Getter for the fieldmotivation.- Returns:
- the list of IIIF motivation values used to filter search results
-
getMotivationAsString
-
setUser
Setter for the fielduser.- Parameters:
user- the user filter value; currently ignored and recorded as an ignored parameter- Returns:
- this IIIFSearchBuilder instance for method chaining
-
getUser
Getter for the fielduser.- Returns:
- the user filter value; currently recorded but not applied to search results
-
setDate
Setter for the fielddate.- Parameters:
date- the date filter value; currently ignored and recorded as an ignored parameter- Returns:
- this IIIFSearchBuilder instance for method chaining
-
getDate
Getter for the fielddate.- Returns:
- the date filter value; currently recorded but not applied to search results
-
getMin
Getter for the fieldmin.- Returns:
- the minimum relevance threshold filter value; currently recorded but not applied to search results
-
setMin
Setter for the fieldmin.- Parameters:
min- the minimum relevance threshold filter; currently ignored and recorded as an ignored parameter- Returns:
- this IIIFSearchBuilder instance for method chaining
-
setPage
Setter for the fieldpage.- Parameters:
page- the 1-based result page number; ignored if null- Returns:
- this IIIFSearchBuilder instance for method chaining
-
getPage
public int getPage()Getter for the fieldpage.- Returns:
- the 1-based result page number
-
getHitsPerPage
public int getHitsPerPage()Getter for the fieldhitsPerPage.- Returns:
- the maximum number of hits returned per result page
-
setHitsPerPage
Setter for the fieldhitsPerPage.- Parameters:
hitsPerPage- the maximum number of hits to return per result page- Returns:
- this IIIFSearchBuilder instance for method chaining
-
build
public de.intranda.api.iiif.search.SearchResult build() throws PresentationException, IndexUnreachableExceptionCreates aSearchResultcontaining annotations matchinggetQuery()withingetPi(). The answer may contain more thangetHitsPerPage()hits if more than one motivation is searched, but no more thangetHitsPerPage()hits per motivation.- Returns:
- the search result
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
buildAutoSuggest
public de.intranda.api.iiif.search.AutoSuggestResult buildAutoSuggest() throws PresentationException, IndexUnreachableException- Returns:
- The searchTerm list
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-