Class NCSCollectionFileIndexingWriter

All Implemented Interfaces:
DocWriter

public class NCSCollectionFileIndexingWriter extends XMLFileIndexingWriter
Used to write a Lucene Document for a NCS Collection XML record.
Author:
John Weatherley
See Also:
  • Constructor Details

    • NCSCollectionFileIndexingWriter

      public NCSCollectionFileIndexingWriter()
      Create a NCSCollectionFileIndexingWriter.
  • Method Details

    • getTitle

      public String getTitle() throws Exception
      Returns the title for the collection.
      Specified by:
      getTitle in class XMLFileIndexingWriter
      Returns:
      The title value
      Throws:
      Exception - If error reading XML.
    • getDescription

      public String getDescription() throws Exception
      The description for the collection.
      Specified by:
      getDescription in class XMLFileIndexingWriter
      Returns:
      The description String
      Throws:
      Exception - If error reading XML.
    • getUrls

      public String[] getUrls() throws Exception
      Gets the URL to the collection.
      Specified by:
      getUrls in class XMLFileIndexingWriter
      Returns:
      The collectionUrl value
      Throws:
      Exception - If error
    • _getIds

      protected String[] _getIds() throws Exception
      Gets the ID of this collection record.
      Specified by:
      _getIds in class XMLFileIndexingWriter
      Returns:
      The ID
      Throws:
      Exception - If error
    • getDocType

      public String getDocType()
      Gets the docType attribute of the NCSCollectionFileIndexingWriter, which is 'ncs_collect.'
      Specified by:
      getDocType in interface DocWriter
      Specified by:
      getDocType in class FileIndexingServiceWriter
      Returns:
      The docType, which is 'ncs_collect.'
    • getReaderClass

      public String getReaderClass()
      Gets the name of the concrete DocReader class that is used to read this type of Document, which is "XMLDocReader".
      Specified by:
      getReaderClass in interface DocWriter
      Specified by:
      getReaderClass in class FileIndexingServiceWriter
      Returns:
      The String "org.dlese.dpc.index.reader.XMLDocReader".
    • getWhatsNewDate

      protected Date getWhatsNewDate() throws Exception
      Returns the date used to determine "What's new" in the library. Just returns the file mod date.
      Specified by:
      getWhatsNewDate in class XMLFileIndexingWriter
      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

      protected String getWhatsNewType()
      Returns 'collection'.
      Specified by:
      getWhatsNewType in class XMLFileIndexingWriter
      Returns:
      The string 'collection'.
    • init

      public void init(File source, org.apache.lucene.document.Document existingDoc) throws Exception
      Nothing needed
      Specified by:
      init in class XMLFileIndexingWriter
      Parameters:
      source - The source file being indexed
      existingDoc - 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:
      destroy in class FileIndexingServiceWriter
    • getValidationReport

      protected String getValidationReport() throws Exception
      Gets a report detailing any errors found in the XML validation of the collection record, or null if no error was found.
      Overrides:
      getValidationReport in class FileIndexingServiceWriter
      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()
      Place the entire XML content into the default and stems search field.
      Specified by:
      indexFullContentInDefaultAndStems in class XMLFileIndexingWriter
      Returns:
      True
    • 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 collection-level Document.
      Specified by:
      addFields in class XMLFileIndexingWriter
      Parameters:
      newDoc - The new Document that is being created for this resource
      existingDoc - An existing Document that currently resides in the index for the given resource, or null if none was previously present
      sourceFile - The sourceFile that is being indexed.
      Throws:
      Exception - If an error occurs