Feature Pack 8

Configuring operations to run after verifying the search index

You can use the search index verification framework to perform specific operations after verifying the integrity of the search index. You can create and configure upon success and upon failure operations that are run after verifying the state of the search index.

Before you begin

  1. Download the interim fix for APAR JR53475, or apply the latest cumulative interim fix for Feature Pack 8, JR53438.fep.
  2. Complete the following task: Creating a custom project for search-related customizations.
  3. Ensure you are using the managed-configuration generated templates. For more information, see Deploying and working with the WebSphere Commerce search server in the managed configuration.

About this task

The following list shows the high-level steps that are associated with configuring operations to run after verifying the search index:
  1. Create a new custom operation by inserting an entry into the administration logger with the version of the replicated index.
  2. Configure the custom operation to be run as a result of an upon success status.

Procedure

  1. Creating the new custom operation:
    1. Create a new package for the custom operation called com.mycompany.commerce.foundation.solr.operation.
    2. Create a new class called SolrDoSampleOperation that implements the com.ibm.commerce.foundation.solr.operation.SolrDoCoreOperation interface.
    3. Add the unimplemented methods:
      
      @Override
      	public Boolean doOperation(NamedList operationProps)
      			throws RuntimeException {
      		// TODO Auto-generated method stub
      		return null;
      	}
      
      	@Override
      	public NamedList getStatistics() {
      		// TODO Auto-generated method stub
      		return null;
      	}
      
      	@Override
      	public Boolean isRunning() {
      		// TODO Auto-generated method stub
      		return null;
      }
      
    4. Define class-level locale variables to set the SolrCore and statistics objects:
      
      private NamedList statistics = null;
      private SolrCore iCore;
      
    5. Create a class constructor that sets the SolrCore object:
      
      public SolrDoSampleOperation(SolrCore solrCore) {
      			iCore = solrCore;
      		}
      
    6. Add logic to retrieve the version of the index and log it. Refer to the following sample code for reference: SearchServerExtensionsLogic.zip.
    7. Save your changes and close the file.
    8. Deploy the customized file to the production environment.
  2. Register the custom operation class to run as a result of an upon success status.
    1. Open the solr.xml file of one of the managed-configurations templates for editing.
    2. Add the following properties into the core that you want to configure your custom operation:
      
      <property name="healthCheckOps.enable" value="true"/>
      <property name="healthCheckOps.uponSuccessOps" value=" com.mycompany.commerce.foundation.solr.operation.SolrDoSampleOperation"/>
      
      For example:
      
      <core name="MC_10001_CatalogEntry_en_US" instanceDir="MC_10001\en_US\CatalogEntry\">
      <property name="master.server.url" value="localhost"/>
      <property name="replication.enable.slave" value="true"/>
      <property name="solr.replication.pollInterval" value="00:60:00"/>
       <property name="core.dir" value="MC_10001\en_US\CatalogEntry"/>
          
      <property name="healthCheckOps.enable" value="true"/>
      <property name="healthCheckOps.uponSuccessOps" value=" com.mycompany.commerce.foundation.solr.operation.SolrDoSampleOperation"/>
      </core>
      
    3. Save your changes and close the file.

Results

The next time index replication occurs, an entry with the version number of the index is logged.

What to do next

Deploy WebSphere Commerce search in the managed configuration.