org.dlese.dpc.repository.indexing
Interface IndexFieldPreprocessor


public interface IndexFieldPreprocessor

Interface used to pre-process content for a custom field prior to indexing it. A single instance of the concrete class will be created and reused when processing the configured field(s) for each Document that is added to the index.

Author:
John Weatherley

Method Summary
 void contextConfigListener(Object contextConfig)
          Implement this method to receive the context configuration object, which may be used to fetch configuration settings.
 String[] processFieldContent(String fieldContent, org.apache.lucene.document.Document newLuceneDoc, org.dom4j.Document xmlDoc)
          Implement this method to pre-process the configured custom XPath field content for each Lucene Document.
 

Method Detail

processFieldContent

String[] processFieldContent(String fieldContent,
                             org.apache.lucene.document.Document newLuceneDoc,
                             org.dom4j.Document xmlDoc)
Implement this method to pre-process the configured custom XPath field content for each Lucene Document. The existing content is passed in as a String and the resulting preprocessed content must be passed back as an array of Strings. For each element in the array, a saparate call to Document will be made. Return null to have no content indexed for the given Document. As a convenience the Lucene Document is passed in so additional custom fields can be written if needed. The XML Document is passed in to allow access to other content as needed.

Parameters:
fieldContent - The existing content found at the configured XPath for a given custom field
newLuceneDoc - The new Lucene Document that will be inserted in the index for this record
xmlDoc - The dom4j Document that is being indexed in this context
Returns:
The processed content that will be used by the indexer to index the given field, or null to indicate none

contextConfigListener

void contextConfigListener(Object contextConfig)
Implement this method to receive the context configuration object, which may be used to fetch configuration settings. For webapps, a instance of ServletContext is passeed in. This method is called once after the class is first instantiated and before processFieldContent(java.lang.String, org.apache.lucene.document.Document, org.dom4j.Document) first called.

Parameters:
contextConfig - The context configuration object, for example and instance of ServletContext