public class ErrorFileIndexingWriter extends FileIndexingServiceWriter
Document
that represents an error that has occured in
in indexing a File. This writer is used by FileIndexingService
. The FileIndexingServiceWriter
may throw a ErrorDocException
, which can be
used to specific specific fields to index with the exception.
The Lucene Document
fields that are created by this class are (in
addition the the ones listed for FileIndexingServiceWriter
) all fields
specified in the ErrorDocException
are stored plus:
error
- Set to 'true' for all documents indexed by this writer. Not stored.
errormsg
- The description of the error, for display. Stored.
errordoctype
- The type of error thrown as specified by ErrorDocException
.
Defaults to 'generic'. Stored.
exception
- The name of the Java exception that was thrown. Stored.
FileIndexingServiceWriter
,
FileIndexingService
,
ErrorDocException
Constructor and Description |
---|
ErrorFileIndexingWriter(java.lang.Throwable exception)
Constructor for the ErrorFileIndexingWriter object
|
Modifier and Type | Method and Description |
---|---|
protected void |
addCustomFields(org.apache.lucene.document.Document newDoc,
org.apache.lucene.document.Document existingDoc,
java.io.File sourceFile)
Adds the error message to the Lucene document.
|
protected void |
destroy()
Does nothing.
|
java.lang.String |
getDocGroup()
Gets the specifier associated with this group of files or null if no group association exists.
|
java.lang.String |
getDocType()
Gets the docType, which is 'errordoc.'
|
java.lang.String |
getReaderClass()
Gets the name of the concrete
DocReader class that is used to read
this type of Document , which is "ErrorDocReader". |
void |
init(java.io.File source,
org.apache.lucene.document.Document existingDoc)
Does nothing.
|
abortIndexing, addDocToRemove, addToAdminDefaultField, addToDefaultField, create, getConfigAttributes, getDeletedDoc, getDocsource, getFileContent, getFileIndexingPlugin, getFileIndexingService, getLuceneDoc, getPreviousRecordDoc, getSessionAttributes, getSourceDir, getSourceFile, getValidationReport, isMakingDeletedDoc, isValidationEnabled, prtln, prtlnErr, setConfigAttributes, setDebug, setFileIndexingPlugin, setFileIndexingService, setIsMakingDeletedDoc, setValidationEnabled
public ErrorFileIndexingWriter(java.lang.Throwable exception)
exception
- The exception that was thrown when the error occured.public java.lang.String getDocType() throws java.lang.Exception
getDocType
in interface DocWriter
getDocType
in class FileIndexingServiceWriter
java.lang.Exception
- If error.public java.lang.String getDocGroup()
getDocGroup
in class FileIndexingServiceWriter
public java.lang.String getReaderClass()
DocReader
class that is used to read
this type of Document
, which is "ErrorDocReader".getReaderClass
in interface DocWriter
getReaderClass
in class FileIndexingServiceWriter
protected final void addCustomFields(org.apache.lucene.document.Document newDoc, org.apache.lucene.document.Document existingDoc, java.io.File sourceFile) throws java.lang.Exception
addCustomFields
in class FileIndexingServiceWriter
newDoc
- The new Document that is being created for this resourceexistingDoc
- An existing Document that currently resides in the index for the given resource, or
null if none was previously presentsourceFile
- The sourceFile that is being indexed.java.lang.Exception
- If an error occurspublic void init(java.io.File source, org.apache.lucene.document.Document existingDoc) throws java.lang.Exception
init
in class FileIndexingServiceWriter
source
- The source file being indexedexistingDoc
- An existing Document that currently resides in the index for the given resource, or
null if none was previously presentjava.lang.Exception
- If an error occured during set-up.protected void destroy()
destroy
in class FileIndexingServiceWriter