Class IndexBuilder


  • public abstract class IndexBuilder
    extends java.lang.Object
    Abstract base class that builds an index for a search database.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String indexDir  
    • Constructor Summary

      Constructors 
      Constructor Description
      IndexBuilder​(java.lang.String indexDir)
      Builds an index at indexDir.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract void close()
      Closes the index.
      abstract void closeDocument()
      Closes the document.
      abstract java.util.Enumeration getStopWords()
      Returns the list of stopwords for an index.
      abstract void openDocument​(java.lang.String name)
      Opens a document to store information.
      abstract void storeLocation​(java.lang.String text, int position)
      Stores a concept at a given position.
      abstract void storeStopWords​(java.util.Enumeration stopWords)
      Sets the stopwords in an index.
      abstract void storeTitle​(java.lang.String title)
      Stores the title for the document.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • indexDir

        protected java.lang.String indexDir
    • Constructor Detail

      • IndexBuilder

        public IndexBuilder​(java.lang.String indexDir)
                     throws java.lang.Exception
        Builds an index at indexDir. If indexDir already exists the index is opened and the new doucments are merged into the existing document.
        Throws:
        java.lang.Exception
    • Method Detail

      • close

        public abstract void close()
                            throws java.lang.Exception
        Closes the index.
        Throws:
        java.lang.Exception
      • storeStopWords

        public abstract void storeStopWords​(java.util.Enumeration stopWords)
        Sets the stopwords in an index. If the stopwords are already defined for an index, the stop words are merged with the existing set of stopwords.
      • getStopWords

        public abstract java.util.Enumeration getStopWords()
        Returns the list of stopwords for an index.
      • openDocument

        public abstract void openDocument​(java.lang.String name)
                                   throws java.lang.Exception
        Opens a document to store information.
        Throws:
        java.lang.Exception
      • closeDocument

        public abstract void closeDocument()
                                    throws java.lang.Exception
        Closes the document. This prevents any additional information from being stored.
        Throws:
        java.lang.Exception
      • storeLocation

        public abstract void storeLocation​(java.lang.String text,
                                           int position)
                                    throws java.lang.Exception
        Stores a concept at a given position.
        Throws:
        java.lang.Exception
      • storeTitle

        public abstract void storeTitle​(java.lang.String title)
                                 throws java.lang.Exception
        Stores the title for the document.
        Throws:
        java.lang.Exception