2.2. Configuring Invocation of Indexing Process

You can use the platform’s scheduled tasks mechanism (see Developer’s ManualCUBA Scheduled tasks) to invoke indexing process on a scheduled basis.

First, you will need to activate the task starting functionality itself. Add the following property to the app.properties file of the project core module:

cuba.schedulingActive = true

Restart the application server, log into the system as admin, open the JMX Console screen, find and open the app-core.cuba:type=Scheduling JMX bean and make sure that the Active attribute is set to true.

Then open the AdministrationScheduled Tasks screen, click Create and fill in the following attribute values for a new task:

  • Defined by: Bean

  • Bean name: cuba_FtsManager

  • Method name: processQueue()

  • Singleton: true

  • Period, sec: 30

Save the task, select it in the table and click Activate. From now on, the system will start indexing changed entities every 30 seconds.

Warning

Automatic indexing does not cover the entities created before its start. To put such entities to the indexing queue use reindexAll() or asyncReindexAll() methods of the app-core.fts:type=FtsManager JMX bean. See Running and configuring entities reindexing.