Class IndexerKit

  • All Implemented Interfaces:
    java.lang.Cloneable

    public abstract class IndexerKit
    extends java.lang.Object
    implements java.lang.Cloneable
    Establishes the requirements of an indexing object for a type of text content. The DefaultKit acts as a factory for policy. For example, an implementation for HTML and RTF can be provided that is replaceable with other implementations.

    New kits are normally created by cloning a prototype kit.

    • Constructor Summary

      Constructors 
      Constructor Description
      IndexerKit()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.Object clone()
      Creates a copy of the indexer kit.
      protected abstract void endStoreDocument()
      Ends the storing of the document.
      abstract java.lang.String getContentType()
      Gets the MIME type of the data that this kit represents support for.
      java.util.Locale getLocale()
      Gets the Locale.
      abstract void parse​(java.io.Reader in, java.lang.String file, boolean ignoreCharset, IndexBuilder builder, ConfigFile config)
      Parses content from the given stream.
      abstract int parseIntoTokens​(java.lang.String source, int pos)
      Parses a string into tokens and stores the tokens.
      void setLocale​(java.lang.String lang)
      Convenience method for setting the locale from a lang string Takes the lang string in the form of "language_country_variant".
      void setLocale​(java.util.Locale locale)
      Sets the locale for string tokenizing.
      protected abstract void startStoreDocument​(java.lang.String file)
      Starts the storing of the dcoument.
      protected abstract void storeTitle​(java.lang.String title)
      Stores a title in the IndexBuilder.
      protected abstract void storeToken​(java.lang.String token, int pos)
      Stores a token in the IndexBuilder.
      • Methods inherited from class java.lang.Object

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

      • file

        protected java.lang.String file
      • locale

        protected java.util.Locale locale
    • Constructor Detail

      • IndexerKit

        public IndexerKit()
    • Method Detail

      • clone

        public abstract java.lang.Object clone()
        Creates a copy of the indexer kit. This allows an implementation to serve as a prototype for others, so that they can be quickly created.
        Overrides:
        clone in class java.lang.Object
        Returns:
        the copy
      • getContentType

        public abstract java.lang.String getContentType()
        Gets the MIME type of the data that this kit represents support for.
        Returns:
        the type
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Sets the locale for string tokenizing. A null locale value is valid and means that no locale has been set for this IndexerKit.
      • setLocale

        public void setLocale​(java.lang.String lang)
        Convenience method for setting the locale from a lang string Takes the lang string in the form of "language_country_variant". Parses the string and creates an appropriate locale.
        Parameters:
        lang - A string representation of a locale. If lang is null it is the same as setting the locale to null.
      • getLocale

        public java.util.Locale getLocale()
        Gets the Locale.
      • parse

        public abstract void parse​(java.io.Reader in,
                                   java.lang.String file,
                                   boolean ignoreCharset,
                                   IndexBuilder builder,
                                   ConfigFile config)
                            throws java.io.IOException
        Parses content from the given stream. The stream is expected to be in a format appropriate for this content handler to parse into tokens according to the locale of the class. In the absense of a locale, the default locale tokenizer is used.
        Parameters:
        in - The stream to read from.
        file - The file name being parsed.
        builder - The IndexBuilder for the full text insertion.
        config - The indexer configuration information.
        Throws:
        java.io.IOException - on any I/O error.
      • parseIntoTokens

        public abstract int parseIntoTokens​(java.lang.String source,
                                            int pos)
        Parses a string into tokens and stores the tokens.
      • startStoreDocument

        protected abstract void startStoreDocument​(java.lang.String file)
                                            throws java.lang.Exception
        Starts the storing of the dcoument.
        Throws:
        java.lang.Exception
      • endStoreDocument

        protected abstract void endStoreDocument()
                                          throws java.lang.Exception
        Ends the storing of the document.
        Throws:
        java.lang.Exception
      • storeToken

        protected abstract void storeToken​(java.lang.String token,
                                           int pos)
                                    throws java.lang.Exception
        Stores a token in the IndexBuilder.
        Throws:
        java.lang.Exception
      • storeTitle

        protected abstract void storeTitle​(java.lang.String title)
                                    throws java.lang.Exception
        Stores a title in the IndexBuilder.
        Throws:
        java.lang.Exception