You can create a Java™ class to programmatically update the value of security tokens, metadata, and the document content of type A data sources.
When the crawler session starts, the plug-in process is forked. An AbstractCrawlerPlugin object is instantiated with the default constructor and the init, isMetadataUsed, and isContentUsed methods are called one time. During the crawler session, the activate method is called when the crawler starts its crawling and the deactivate method is called when the crawler finishes its crawling. When the crawler session ends, the term method is called and the object is destroyed. If the crawler scheduler is enabled, the activate method is called when the crawling is scheduled to start and the deactivate method is called when the crawling is scheduled to end. Because a single crawler session runs continuously when the crawler scheduler is enabled, the term method is not called to destroy the object.
To create a Java class for use as a crawler plug-in with content-related functions for type A data sources:
public void setSearchable(boolean b)
public void setFieldSearchable(boolean b)
public void setParametricSearchable(boolean b)
public void setAsMetadata(boolean b)
public void setResolveConflict(String string)
public void setContent(boolean b)
public void setExactMatch(boolean b)
public void setSortable(boolean b)
import com.ibm.es.crawler.plug-in.logging.Plug-inLogger;
Add the
following statements after the start of the class declaration:
/** Logger */
private static final PluginLogger logger;
static {
PluginLogger.init(PluginLogger.LOGTYPE_OSS,PluginLogger.LOGLEVEL_INFO);
logger = PluginLogger.getInstance();
}
/** End Logger **/
In
the updateDocument section, add the following statements to output test logging statements
of the type INFO, WARN and
ERROR:/* Testing Logging Statements*/
logger.info("This is info.");
logger.warn("This is warning.");
logger.error("This is error.");
/* End Testing Logging Statements */
With
the default collection settings, these statements cause warning and error messages to be
shown in the collection log file. For
example:W FFQD2801W 2013/04/27 23:02:05.619 CDT plug-in plug-in.WIN_50605.crawlerplug-in
FFQD2801W A warning was generated from the crawler plug-in.
Message: This is a warning message.
E FFQD2800E 2013/04/27 23:02:05.681 CDT plug-in plug-in.WIN_50605.crawlerplug-in
FFQD2800E An error was generated from the crawler plug-in.
Message: This is an error message.
To
show informational messages in the collection log file, open the administration console.
Select the collection, click , and then select All messages for the type of
information to log and trace. After you stop and restart the crawler session,
informational messages appear in the collection log file.