Class DefaultMassIndexingMonitor

java.lang.Object
org.hibernate.search.mapper.pojo.massindexing.DefaultMassIndexingMonitor

@Incubating public final class DefaultMassIndexingMonitor extends Object
A simple builder class that allows configuring the built-in logging mass indexer monitor.

To customize the monitor pass it to the mass indexer as:


 massIndexer.monitor( DefaultMassIndexingMonitor.builder()
     .countOnStart( true )
     .countOnBeforeType( false )
     .build()
 );
 
 
  • Method Details

    • builder

      public static DefaultMassIndexingMonitor builder()
    • build

      public MassIndexingMonitor build()
    • countOnStart

      public DefaultMassIndexingMonitor countOnStart(boolean countOnStart)
      Allows specifying whether the mass indexer should try obtaining the total number of all entities to index before the indexing even starts.

      This means that the default monitor will make an attempt to get the counts in the main thread and only then start the indexing. Then, at index time, the mass indexer may attempt to recalculate the total for a currently indexed type (see countOnBeforeType(boolean).

      Defaults to false.

      Parameters:
      countOnStart - If true, the mass indexer will try determining the total number of all entities to index before the actual indexing starts.
      Returns:
      this for method chaining
    • countOnBeforeType

      public DefaultMassIndexingMonitor countOnBeforeType(boolean countOnBeforeType)
      Allows specifying whether to try determining the total number of entities of the particular type to index and logging that information.

      This count attempt happens right before fetching the IDs to index, and should provide the number of entities to fetch.

      It may be helpful to skip the counting of entities and start the ID fetching right away to save some time.

      Defaults to true.

      Parameters:
      countOnBeforeType - If true, the mass indexer will try determining the total number of entities, otherwise the mass indexer will not try obtaining the total count.
      Returns:
      this for method chaining