Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. The Developer Center continues to support Commerce 6.13.0 through 7.4.1.Visit new site

Scheduled Jobs (Search Server)

Scheduled Jobs (Search Server)

Note:

For information on configuring the settings that control the search behavior, see Search Settings.

The search server has several scheduled jobs to rebuild the search indexes. The quartz.xml file contains settings that configure how and when these jobs run. It is located in the search\ep-search\src\main\resources\spring\scheduling directory.

Search index build jobs

The search server has several index build jobs:

  • customerIndexBuildJob builds the customer index.
  • productIndexBuildJob builds the product index and then builds spell checking index.
  • categoryIndexBuildJob builds the category index.
  • promotionIndexBuildJob builds the promotion index.
  • catalogPromoMonitorJob checks for changes to catalog promotion rules and notifies the search server if any are found.
  • rulebaseCompileJob re-compiles the rule base, and stores it in the database.
  • cmUserIndexBuildJob builds the Commerce Manager user index.
  • shippingServiceLevelIndexBuildJob builds the shipping service level index.
  • skuIndexBuildJob builds the SKU index.
  • optimizeSearchIndicesJob optimizes the search indexes.

Search index optimization job

The search server includes a job to optimize indexes. Indexes should be optimized whenever there has been a significant amount of changes (adds/removes).

The optimizeSearchIndicesTrigger bean configures the trigger that executes the optimization job.

	<bean id="optimizeSearchIndicesTrigger"
		class="org.springframework.scheduling.quartz.SimpleTriggerBean">
		<property name="jobDetail" ref="optimizeSearchIndicesJob"/>
		<!-- Start delay in milliseconds: the first index optimization check will be done 2 minutes after the application starts up -->
		<property name="startDelay" value="120000" />
		<!-- Repeat interval in milliseconds: the check for whether indices should be optimized is set to be done every 5 minutes -->
		<property name="repeatInterval" value="300000" />
	</bean>

The repeatInterval property of the optimizeSearchIndicesTrigger bean determines how often the index optimization job is executed. Individual indexes can be optimized at different intervals by configuring the COMMERCE/SEARCH/indexOptimizationInterval in the System configuration settings, but if indexOptimizationInterval is less than repeatInterval, then the effective interval will be the repeatInterval. For example, if repeatInterval is set to run the job every 5 minutes (300000 milliseconds) and you configure the product index to be optimized every 2 minutes, the index will be optimized every 5 minutes.

Spell checking index optimization

The productIndexBuilder bean builds the product index and the spell checking index. Once the product index build completes, the productIndexBuilder bean checks the spellCheckingIndexRebuildInterval value, which is in milliseconds. If the value has expired, the productIndexBuilder bean builds the spell checking index. If the value has not expired, the spell checking index build is skipped until the product index builds again and the spell checking index timer has expired. You can modify spellCheckingIndexRebuildInterval to suit your application. spellCheckingIndexRebuildInterval property is found in com.elasticpath.search\WEB-INF\conf\spring\service\serviceSearch.xml By default, the spell checking index builds every 1800 milliseconds after the product index builds as shown in the following code snippet.

	<bean id="productIndexBuilder" parent="abstractIndexBuilder" class="com.elasticpath.search.index.solr.builders.impl.ProductIndexBuilder">
		...
		<property name="spellCheckingIndexRebuildInterval" value="1800"/>
		...
	</bean>