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.
About this task
The following list shows the high-level steps that are associated
with configuring operations to run after verifying the search index:
- Create a new custom operation by inserting an entry into the administration
logger with the version of the replicated index.
- Configure the custom operation to be run as a result of an upon
success status.
Procedure
- Creating the new custom operation:
- Create a new package for the custom operation called com.mycompany.commerce.foundation.solr.operation.
- Create a new class called SolrDoSampleOperation that
implements the com.ibm.commerce.foundation.solr.operation.SolrDoCoreOperation interface.
- 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;
}
- Define class-level locale variables to set the SolrCore
and statistics objects:
private NamedList statistics = null;
private SolrCore iCore;
- Create a class constructor that sets the SolrCore object:
public SolrDoSampleOperation(SolrCore solrCore) {
iCore = solrCore;
}
- Add logic to retrieve the version of the index and log
it. Refer to the following sample code for reference: SearchServerExtensionsLogic.zip.
- Save your changes and close the file.
- Deploy
the customized file to the production environment.
- Register the custom operation class to run as a result
of an upon success status.
- Open the solr.xml file of one of
the managed-configurations templates for editing.
- 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>
- 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.