Package org.dlese.dpc.index.writer
Class NewsOppsFileIndexingWriter
java.lang.Object
org.dlese.dpc.index.writer.FileIndexingServiceWriter
org.dlese.dpc.index.writer.XMLFileIndexingWriter
org.dlese.dpc.index.writer.NewsOppsFileIndexingWriter
- All Implemented Interfaces:
DocWriter
Used to write a Lucene
Document for a DLESE news-opps XML record. The
reader for this type of Document is NewsOppsDocReader. - Author:
- John Weatherley
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String[]_getIds()Gets the ID of this collection record.protected final voidaddFields(org.apache.lucene.document.Document newDoc, org.apache.lucene.document.Document existingDoc, File sourceFile) Adds fields to the index that are part of the news-opps Document.protected voiddestroy()This method is called at the conclusion of processing and may be used for tear-down.Return a description for the document being indexed, or null if none applies.Gets the docType attribute of the NewsOppsFileIndexingWriter, which is 'news_opps.'Gets the name of the concreteDocReaderclass that is used to read this type ofDocument, which is "NewsOppsDocReader".getTitle()Return a title for the document being indexed, or null if none applies.String[]getUrls()Return the URL(s) to the resource being indexed, or null if none apply.protected StringGets a report detailing any errors found in the XML validation of the news-opps record, or null if no error was found.protected DateReturns the date used to determine "What's new" in the library, which is the post date.protected StringReturns 'newsopps'.booleanDefault and stems fields handled here, so do not index full content.voidNothing needed.Methods inherited from class org.dlese.dpc.index.writer.XMLFileIndexingWriter
addCustomFields, getBoundingBox, getCollections, getDeletedDoc, getDocGroup, getDom4jDoc, getFieldContent, getFieldContent, getFieldName, getIds, getIndex, getMyAnnoResultDocs, getMyCollectionDoc, getOaiModtime, getPrimaryId, getRecordDataService, getRelatedIds, getRelatedIdsMap, getRelatedUrls, getRelatedUrlsMap, getTermStringFromStringArray, getXmlIndexer, getXmlIndexerFieldsConfigMethods inherited from class org.dlese.dpc.index.writer.FileIndexingServiceWriter
abortIndexing, addDocToRemove, addToAdminDefaultField, addToDefaultField, create, getConfigAttributes, getDocsource, getFileContent, getFileIndexingPlugin, getFileIndexingService, getLuceneDoc, getPreviousRecordDoc, getSessionAttributes, getSourceDir, getSourceFile, isMakingDeletedDoc, isValidationEnabled, prtln, prtlnErr, setConfigAttributes, setDebug, setFileIndexingPlugin, setFileIndexingService, setIsMakingDeletedDoc, setValidationEnabled
-
Field Details
-
FIELD_NS
The News Opps NS- See Also:
-
-
Constructor Details
-
NewsOppsFileIndexingWriter
public NewsOppsFileIndexingWriter()Create a NewsOppsFileIndexingWriter.
-
-
Method Details
-
_getIds
Gets the ID of this collection record.- Specified by:
_getIdsin classXMLFileIndexingWriter- Returns:
- The ID
- Throws:
Exception- If error
-
getUrls
Description copied from class:XMLFileIndexingWriterReturn the URL(s) to the resource being indexed, or null if none apply. If more than one URL references the resource, the first one is the primary. The URL Strings are tokenized and indexed under the field key 'uri' and is also indexed in the 'default' field. It is also stored in the index untokenized under the field key 'url.'- Specified by:
getUrlsin classXMLFileIndexingWriter- Returns:
- The url String(s)
- Throws:
Exception- This method should throw and Exception with appropriate error message if an error occurs.
-
getDescription
Description copied from class:XMLFileIndexingWriterReturn a description for the document being indexed, or null if none applies. The String is tokenized, stored and indexed under the field key 'description' and is also indexed in the 'default' field.- Specified by:
getDescriptionin classXMLFileIndexingWriter- Returns:
- The description String
- Throws:
Exception- This method should throw and Exception with appropriate error message if an error occurs.
-
getTitle
Description copied from class:XMLFileIndexingWriterReturn a title for the document being indexed, or null if none applies. The String is tokenized, stored and indexed under the field key 'title' and is also indexed in the 'default' field.- Specified by:
getTitlein classXMLFileIndexingWriter- Returns:
- The title String
- Throws:
Exception- This method should throw and Exception with appropriate error message if an error occurs.
-
getDocType
Gets the docType attribute of the NewsOppsFileIndexingWriter, which is 'news_opps.'- Specified by:
getDocTypein interfaceDocWriter- Specified by:
getDocTypein classFileIndexingServiceWriter- Returns:
- The docType, which is 'news_opps.'
-
getReaderClass
Gets the name of the concreteDocReaderclass that is used to read this type ofDocument, which is "NewsOppsDocReader".- Specified by:
getReaderClassin interfaceDocWriter- Specified by:
getReaderClassin classFileIndexingServiceWriter- Returns:
- The String "org.dlese.dpc.index.reader.NewsOppsDocReader".
-
getWhatsNewDate
Returns the date used to determine "What's new" in the library, which is the post date.- Specified by:
getWhatsNewDatein classXMLFileIndexingWriter- Returns:
- The what's new date for the item
- Throws:
Exception- This method should throw and Exception with appropriate error message if an error occurs.
-
getWhatsNewType
Returns 'newsopps'.- Specified by:
getWhatsNewTypein classXMLFileIndexingWriter- Returns:
- The string 'newsopps'.
-
init
Nothing needed.- Specified by:
initin classXMLFileIndexingWriter- Parameters:
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 present- Throws:
Exception- If an error occured during set-up.
-
destroy
protected void destroy()This method is called at the conclusion of processing and may be used for tear-down.- Specified by:
destroyin classFileIndexingServiceWriter
-
getValidationReport
Gets a report detailing any errors found in the XML validation of the news-opps record, or null if no error was found.- Overrides:
getValidationReportin classFileIndexingServiceWriter- Returns:
- Null if no data validation errors were found, otherwise a String that details the nature of the error.
- Throws:
Exception- If error in performing the validation.
-
indexFullContentInDefaultAndStems
public boolean indexFullContentInDefaultAndStems()Default and stems fields handled here, so do not index full content.- Specified by:
indexFullContentInDefaultAndStemsin classXMLFileIndexingWriter- Returns:
- False
-
addFields
protected final void addFields(org.apache.lucene.document.Document newDoc, org.apache.lucene.document.Document existingDoc, File sourceFile) throws Exception Adds fields to the index that are part of the news-opps Document.- Specified by:
addFieldsin classXMLFileIndexingWriter- Parameters:
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.- Throws:
Exception- If an error occurs
-