Class IndexerTools

java.lang.Object
io.goobi.viewer.controller.IndexerTools

public final class IndexerTools extends Object
Utility class for Solr indexer interactions (indexing, deleting, etc.).
  • Field Details

    • SUFFIX_FULLTEXT_CROWDSOURCING

      public static final String SUFFIX_FULLTEXT_CROWDSOURCING
      Constant SUFFIX_FULLTEXT_CROWDSOURCING="_txtcrowd".
      See Also:
    • SUFFIX_ALTO_CROWDSOURCING

      public static final String SUFFIX_ALTO_CROWDSOURCING
      Constant SUFFIX_ALTO_CROWDSOURCING="_altocrowd".
      See Also:
    • SUFFIX_USER_GENERATED_CONTENT

      public static final String SUFFIX_USER_GENERATED_CONTENT
      Constant SUFFIX_USER_GENERATED_CONTENT="_ugc".
      See Also:
    • SUFFIX_CMS

      public static final String SUFFIX_CMS
      Constant SUFFIX_CMS="_cms".
      See Also:
  • Method Details

    • shutdown

      public static void shutdown()
      Shuts down the background re-indexing executor. Called by ContextListener during application shutdown. Waits up to 5 seconds for running tasks to finish.
    • triggerReIndexRecord

      public static void triggerReIndexRecord(String pi)
      Re-index in background thread to significantly decrease saving times.
      Parameters:
      pi - record identifier to re-index
    • triggerReIndexRecord

      public static void triggerReIndexRecord(String pi, List<? extends IndexAugmenter> augmenters)
    • triggerReIndexCMSPage

      public static void triggerReIndexCMSPage(CMSPage page, List<? extends IndexAugmenter> augmenters)
      Parameters:
      page - CMS page to re-index in a background thread
      augmenters - list of index augmenters contributing additional data
    • reIndexRecord

      public static boolean reIndexRecord(String pi) throws DAOException, RecordNotFoundException
      Writes the record into the hotfolder for re-indexing. Modules can contribute data for re-indexing. Execution of method can take a while, so if performance is of importance, use triggerReIndexRecord instead.
      Parameters:
      pi - record identifier to re-index
      Returns:
      true if the record was successfully exported for re-indexing, false otherwise
      Throws:
      DAOException - if any.
      RecordNotFoundException - if any.
    • reIndexRecord

      public static boolean reIndexRecord(String pi, Collection<? extends IndexAugmenter> augmenters) throws DAOException, RecordNotFoundException
      Writes the record into the hotfolder for re-indexing. Modules can contribute data for re-indexing. Execution of method can take a while, so if performance is of importance, use triggerReIndexRecord instead.
      Parameters:
      pi - record identifier to re-index
      augmenters - list of index augmenters contributing additional data
      Returns:
      true if export for reindexing successful; false otherwise
      Throws:
      DAOException - if any.
      RecordNotFoundException - if any.
    • reIndexPage

      public static boolean reIndexPage(String pi, int page) throws DAOException, PresentationException, IndexUnreachableException, IOException
      reIndexPage.
      Parameters:
      pi - record identifier to re-index
      page - order number of the page to re-index
      Returns:
      true if the page was successfully exported for re-indexing, false otherwise
      Throws:
      DAOException - if any.
      PresentationException - if any.
      IndexUnreachableException - if any.
      IOException - if any.
    • reIndexPage

      public static boolean reIndexPage(String pi, int page, Collection<? extends IndexAugmenter> augmenters) throws PresentationException, IndexUnreachableException, IOException
      reIndexPage.
      Parameters:
      pi - record identifier to re-index
      page - order number of the page to re-index
      augmenters - list of index augmenters contributing additional data
      Returns:
      true if export for reindexing successful; false otherwise
      Throws:
      DAOException - if any.
      PresentationException - if any.
      IndexUnreachableException - if any.
      IOException - if any.
    • deleteRecord

      public static boolean deleteRecord(String pi, boolean createTraceDocument, Path hotfolderPath) throws IOException
      deleteRecord.
      Parameters:
      pi - record identifier to delete
      createTraceDocument - true to create a .delete trace document, false to purge completely
      hotfolderPath - path to the indexer hotfolder
      Returns:
      true if the deletion trigger file was successfully created in the hotfolder, false otherwise
      Throws:
      IOException - if any.
    • reIndexCMSPage

      public static boolean reIndexCMSPage(CMSPage page, Collection<? extends IndexAugmenter> augmenters)
      Parameters:
      page - CMS page to export to the hotfolder for re-indexing
      augmenters - list of index augmenters contributing additional data
      Returns:
      true if export for reindexing successful; false otherwise