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

Configuring Search Server Scheduled Jobs

Configuring Search Server Scheduled Jobs

The Search Server has a number of jobs which run on a regular cadence. These jobs are configurable in the following ways:

  • The quartz.xml file in the commerce-engine/search/ep-search module's src/main/resources/spring/scheduling directory.
  • The ep.properties file in the commerce-extensions module.

Search Index Build Jobs

The Elastic Path Quartz Jobs page contains a list of the Search server's index build jobs.

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>