Class IIIFSearchBuilder

java.lang.Object
io.goobi.viewer.model.iiif.search.IIIFSearchBuilder

public class IIIFSearchBuilder extends Object
Creates a IIIF Search API v1.0 response as SearchResult.
Author:
Florian Alpers
  • 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 URIs
      query - the query string
      pi - the pi of the manifest to search
      request - the current HTTP servlet request
  • Method Details

    • getQuery

      public String getQuery()
      Getter for the field query.
      Returns:
      the search query string
    • getPi

      public String getPi()
      Getter for the field pi.
      Returns:
      the persistent identifier of the record to search within
    • setMotivation

      public IIIFSearchBuilder setMotivation(String motivation)
      Setter for the field motivation.
      Parameters:
      motivation - space- or plus-separated list of IIIF motivation values to filter search results
      Returns:
      this IIIFSearchBuilder instance for method chaining
    • getMotivation

      public List<String> getMotivation()
      Getter for the field motivation.
      Returns:
      the list of IIIF motivation values used to filter search results
    • getMotivationAsString

      public String getMotivationAsString()
    • setUser

      public IIIFSearchBuilder setUser(String user)
      Setter for the field user.
      Parameters:
      user - the user filter value; currently ignored and recorded as an ignored parameter
      Returns:
      this IIIFSearchBuilder instance for method chaining
    • getUser

      public String getUser()
      Getter for the field user.
      Returns:
      the user filter value; currently recorded but not applied to search results
    • setDate

      public IIIFSearchBuilder setDate(String date)
      Setter for the field date.
      Parameters:
      date - the date filter value; currently ignored and recorded as an ignored parameter
      Returns:
      this IIIFSearchBuilder instance for method chaining
    • getDate

      public String getDate()
      Getter for the field date.
      Returns:
      the date filter value; currently recorded but not applied to search results
    • getMin

      public String getMin()
      Getter for the field min.
      Returns:
      the minimum relevance threshold filter value; currently recorded but not applied to search results
    • setMin

      public IIIFSearchBuilder setMin(String min)
      Setter for the field min.
      Parameters:
      min - the minimum relevance threshold filter; currently ignored and recorded as an ignored parameter
      Returns:
      this IIIFSearchBuilder instance for method chaining
    • setPage

      public IIIFSearchBuilder setPage(Integer page)
      Setter for the field page.
      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 field page.
      Returns:
      the 1-based result page number
    • getHitsPerPage

      public int getHitsPerPage()
      Getter for the field hitsPerPage.
      Returns:
      the maximum number of hits returned per result page
    • setHitsPerPage

      public IIIFSearchBuilder setHitsPerPage(int hitsPerPage)
      Setter for the field hitsPerPage.
      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, IndexUnreachableException
      Creates a SearchResult containing annotations matching getQuery() within getPi(). The answer may contain more than getHitsPerPage() hits if more than one motivation is searched, but no more than getHitsPerPage() 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
      Creates a AutoSuggestResult containing searchTerms matching getQuery() within getPi().
      Returns:
      The searchTerm list
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.