Class FullTextIndexer2


  • public class FullTextIndexer2
    extends java.lang.Object
    An indexer bean replacing the 5.4 full-text thread FullTextIndexer with adequate functionality. Exists as a stand-in while Hibernate / Spring upgrade issues remain unresolved.

    Ignores the 5.4 full-text thread's configuration properties:

    • omero.search.repetitions
    • omero.search.reporting_loops

    In not using the the 5.4 event log loader also ignores:

    • omero.search.batch
    • omero.search.event_log_loader
    • omero.search.excludes
    • omero.search.max_partition_size

    Further, the value of omero.search.cron is ignored except for that a blank value still disables the indexing thread.

    The start() and stop() methods are the means by which Spring controls the indexing thread's lifecycle. The start() method schedules the OPTMIIZE Quartz job. Interplay among the Quartz jobs is:

    PREPARE
    1. From the event log note a batch of new activity.
    2. Then if there are new objects to index then trigger INDEX.
    3. Else if objects were deleted then trigger PURGE.
    4. Else if new event log entries were reviewed then trigger NOTE.
    5. Else if much purging has been done of some object type since its previous OPTIMIZE then trigger another.
    6. Else schedule PREPARE for delayed execution.
    INDEX
    1. If locking the field bridge fails then schedule INDEX for delayed execution then finish.
    2. Index a batch of objects.
    3. Then if objects were deleted then trigger PURGE.
    4. Else trigger NOTE.
    PURGE
    1. If locking the field bridge fails then schedule PURGE for delayed execution then finish.
    2. Purge a batch of objects.
    3. Then trigger NOTE.
    NOTE
    1. Write a note of progress through the event log back to the database.
    2. Then trigger PREPARE.
    OPTIMIZE
    1. If much purging has been done of some object type since the previous OPTIMIZE then optimize its index.
    2. Else optimize the whole search index.
    3. Then trigger PREPARE.
    Since:
    5.5.0
    • Constructor Summary

      Constructors 
      Constructor Description
      FullTextIndexer2​(org.quartz.Scheduler scheduler, org.hibernate.SessionFactory sessionFactory, org.hibernate.search.bridge.FieldBridge bridge, java.lang.String countKey, java.lang.String actionsList, java.lang.String includeTypesList)
      Construct a new indexer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void index()
      Index a batch of model objects.
      void note()
      Note which event log entries were processed.
      void optimize()
      Defragment the search index.
      void prepare()
      Query the database for new event log entries indicating model objects to process.
      void purge()
      Purge a batch of model objects.
      void setCronExpression​(java.lang.String cronExpression)  
      void start()
      Start the indexer.
      void stop()
      Stop the indexer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FullTextIndexer2

        public FullTextIndexer2​(org.quartz.Scheduler scheduler,
                                org.hibernate.SessionFactory sessionFactory,
                                org.hibernate.search.bridge.FieldBridge bridge,
                                java.lang.String countKey,
                                java.lang.String actionsList,
                                java.lang.String includeTypesList)
        Construct a new indexer.
        Parameters:
        scheduler - the Quartz scheduler for the indexing jobs
        sessionFactory - the Hibernate session factory
        bridge - the field bridge to set when indexing
        countKey - the name of the configuration key for tracking progress through the event log
        actionsList - the event log actions to take note of, comma-separated
        includeTypesList - the names of the model object classes to index, comma-separated
    • Method Detail

      • setCronExpression

        public void setCronExpression​(java.lang.String cronExpression)
        Parameters:
        cronExpression - the cron expression configured for triggering indexing
      • start

        public void start()
        Start the indexer. Ongoing operation occurs via Quartz.
      • stop

        public void stop()
        Stop the indexer.
      • prepare

        public void prepare()
        Query the database for new event log entries indicating model objects to process.
      • index

        public void index()
        Index a batch of model objects.
      • purge

        public void purge()
        Purge a batch of model objects.
      • note

        public void note()
        Note which event log entries were processed.
      • optimize

        public void optimize()
        Defragment the search index.