Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.lucene
Class Indexer

    java.lang.Object
      com.knowgate.lucene.Indexer

Direct Known Subclasses:
  BugIndexer, ContactIndexer, MailIndexer, NewsMessageIndexer

    public class Indexer

extends java.lang.Object

Data Feeder from hipergate tables for Lucene

See Also:
  `http://lucene.apache.org/java/2_3_0/api/core/index.html`

Field Summary
`static java.lang.String` | `DEFAULT_ANALYZER`

Constructor Summary
`Indexer()`

Method Summary
`static void` | `add(IndexWriter oIWrt, java.util.Map oKeywords, java.util.Map oTexts, java.util.Map oUnStored)`
`static void` | `add(java.lang.String sTableName, java.util.Properties oProps, java.lang.String sGUID, int iNumber, java.lang.String sWorkArea, java.lang.String sContainer, java.lang.String sTitle, java.lang.String sText, java.lang.String sAuthor, java.lang.String sAbstract, java.lang.String sComments)` Deprecated. Use add method from Indexer subclasses instead
`static void` | `add(java.lang.String sTableName, java.lang.String sDirectory, java.lang.String sAnalyzer, java.util.Map oKeywords, java.util.Map oTexts, java.util.Map oUnStored)`
`static int` | `delete(java.lang.String sTableName, java.lang.String sWorkArea, java.util.Properties oProps, java.lang.String sGuid)` Delete a document with a given GUID
`static void` | `main(java.lang.String[] argv)` Static method for calling indexer from the command line
`static void` | `optimize(java.util.Properties oProps, java.lang.String sTableName, java.lang.String sWorkArea)` Optimize a given index
`static void` | `rebuild(java.util.Properties oProps, java.lang.String sTableName)` Rebuild Full Text Index for a table for all WorkAreas
`static void` | `rebuild(java.util.Properties oProps, java.lang.String sTableName, java.lang.String sWorkArea)` Rebuild Full Text Index for a table restricting to a given WorkArea Indexed documents have the following fields: Field Name Description Indexed Stored workareaGUID of WorkAreaYes | Yes containerName of Container (NewsGroup, Project, etc) | Yes | Yes guidGUID for Retrieved Object | Yes | Yes numberObject Ordinal Identifier | Yes | Yes titleTitle or Subject | Yes | Yes authorAuthor | Yes | Yes textDocument Text | Yes | No abstractFirst 80 characters of text | No | Yes

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_ANALYZER

    public static final java.lang.String DEFAULT_ANALYZER

See Also:
  Constant Field Values

Constructor Detail

### Indexer

    public Indexer()

Method Detail

### optimize

    public static void optimize(java.util.Properties oProps,
                                java.lang.String sTableName,
                                java.lang.String sWorkArea)
                         throws java.lang.NoSuchFieldException,
                                java.lang.IllegalArgumentException,
                                java.lang.ClassNotFoundException,
                                java.io.FileNotFoundException,
                                java.io.IOException,
                                java.lang.InstantiationException,
                                java.lang.IllegalAccessException

  Optimize a given index

  Parameters:
    `oProps` - Properties Collection (typically loaded from hipergate.cnf) containing luceneindex property and (optionally) analyzer
    `sTableName` - String Name of table to be indexed (currently only k_bugs, k_newsmsgs or k_mime_msgs are permitted)
    `sWorkArea` - GUID of WorkArea to be optimized
  Throws:
    `java.lang.NoSuchFieldException`
    `java.lang.IllegalArgumentException`
    `java.lang.ClassNotFoundException`
    `java.io.IOException`
    `java.lang.InstantiationException`
    `java.lang.IllegalAccessException`
    `java.io.FileNotFoundException`

### rebuild

    public static void rebuild(java.util.Properties oProps,
                               java.lang.String sTableName,
                               java.lang.String sWorkArea)
                        throws java.sql.SQLException,
                               java.io.IOException,
                               java.lang.ClassNotFoundException,
                               java.lang.IllegalArgumentException,
                               java.lang.NoSuchFieldException,
                               java.lang.IllegalAccessException,
                               java.lang.InstantiationException

  Rebuild Full Text Index for a table restricting to a given WorkArea

  Indexed documents have the following fields:

  Field Name | Description | Indexed | Stored
  workarea | GUID of WorkArea | Yes | Yes
  container | Name of Container (NewsGroup, Project, etc) | Yes | Yes
  guid | GUID for Retrieved Object | Yes | Yes
  number | Object Ordinal Identifier | Yes | Yes
  title | Title or Subject | Yes | Yes
  author | Author | Yes | Yes
  text | Document Text | Yes | No
  abstract | First 80 characters of text | No | Yes

  Parameters:
    `oProps` - Properties Collection (typically loaded from hipergate.cnf) containing:
    driver : Class name for JDBC driver
    dburl : Database Connection URL
    dbuser : Database User
    dbpassword : Database User Password
    luceneindex : Base path for Lucene index directories, the rebuilded index will be stored at a subdirectory called as the table name.
    `sTableName` - Name of table to be indexed (currently only k_bugs, k_newsmsgs or k_mime_msgs are permitted) analyzer : org.apache.lucene.analysis.Analyzer subclass name
    `sWorkArea` - GUID of WorkArea to be rebuilt
  Throws:
    `java.lang.NoSuchFieldException` - If any of the requiered properties of oProps is not found
    `java.lang.ClassNotFoundException` - If JDBC driver or analyzer classes are not found
    `java.sql.SQLException`
    `java.io.IOException`
    `java.lang.IllegalArgumentException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`

### rebuild

    public static void rebuild(java.util.Properties oProps,
                               java.lang.String sTableName)
                        throws java.sql.SQLException,
                               java.io.IOException,
                               java.lang.ClassNotFoundException,
                               java.lang.IllegalArgumentException,
                               java.lang.NoSuchFieldException,
                               java.lang.IllegalAccessException,
                               java.lang.InstantiationException

  Rebuild Full Text Index for a table for all WorkAreas

  Parameters:
    `oProps` -
    `sTableName` -
  Throws:
    `java.sql.SQLException`
    `java.io.IOException`
    `java.lang.ClassNotFoundException`
    `java.lang.IllegalArgumentException`
    `java.lang.NoSuchFieldException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`

### add

    public static void add(IndexWriter oIWrt,
                           java.util.Map oKeywords,
                           java.util.Map oTexts,
                           java.util.Map oUnStored)
                    throws java.lang.ClassNotFoundException,
                           java.io.IOException,
                           java.lang.IllegalArgumentException,
                           java.lang.NoSuchFieldException,
                           java.lang.IllegalAccessException,
                           java.lang.InstantiationException,
                           java.lang.NullPointerException

  Throws:
    `java.lang.ClassNotFoundException`
    `java.io.IOException`
    `java.lang.IllegalArgumentException`
    `java.lang.NoSuchFieldException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`
    `java.lang.NullPointerException`

### add

    public static void add(java.lang.String sTableName,
                           java.lang.String sDirectory,
                           java.lang.String sAnalyzer,
                           java.util.Map oKeywords,
                           java.util.Map oTexts,
                           java.util.Map oUnStored)
                    throws java.lang.ClassNotFoundException,
                           java.io.IOException,
                           java.lang.IllegalArgumentException,
                           java.lang.NoSuchFieldException,
                           java.lang.IllegalAccessException,
                           java.lang.InstantiationException,
                           java.lang.NullPointerException

  Throws:
    `java.lang.ClassNotFoundException`
    `java.io.IOException`
    `java.lang.IllegalArgumentException`
    `java.lang.NoSuchFieldException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`
    `java.lang.NullPointerException`

### add

    public static void add(java.lang.String sTableName,
                           java.util.Properties oProps,
                           java.lang.String sGUID,
                           int iNumber,
                           java.lang.String sWorkArea,
                           java.lang.String sContainer,
                           java.lang.String sTitle,
                           java.lang.String sText,
                           java.lang.String sAuthor,
                           java.lang.String sAbstract,
                           java.lang.String sComments)
                    throws java.lang.ClassNotFoundException,
                           java.io.IOException,
                           java.lang.IllegalArgumentException,
                           java.lang.NoSuchFieldException,
                           java.lang.IllegalAccessException,
                           java.lang.InstantiationException,
                           java.lang.NullPointerException

  Deprecated. Use add method from Indexer subclasses instead

  Add a document to the index

  Parameters:
    `sTableName` - k_bugs, k_newsmsgs or k_mime_msgs
    `oProps` - Properties Collection containing luceneindex directory
    `sWorkArea` - WorkArea for document
    `sContainer` - GUID of Category or NewsGroup to which documento belongs
    `sGUID` - Document GUID
    `iNumber` - Document number (optional, may be zero)
    `sTitle` - Document Title (optional, may be null)
    `sText` - Document text (optional, may be null)
    `sAuthor` - Document author (optional, may be null)
    `sAbstract` - Document abstract (optional, may be null)
    `sComments` - Document comments (optional, may be null)
  Throws:
    `java.lang.ClassNotFoundException`
    `java.io.IOException`
    `java.lang.IllegalArgumentException` - If sTableName is not one of { k_bugs, k_newsmsgs, k_mime_msgs }
    `java.lang.NoSuchFieldException` - If luceneindex property is not found at oProps
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`
    `java.lang.NullPointerException`

### delete

    public static int delete(java.lang.String sTableName,
                             java.lang.String sWorkArea,
                             java.util.Properties oProps,
                             java.lang.String sGuid)
                      throws java.lang.IllegalArgumentException,
                             java.lang.NoSuchFieldException,
                             java.lang.IllegalAccessException,
                             java.io.IOException,
                             java.lang.NullPointerException

  Delete a document with a given GUID

  Parameters:
    `sTableName` - k_bugs, k_newsmsgs or k_mime_msgs
    `oProps` - Properties Collection containing luceneindex directory
    `sGuid` - Document GUID
  Returns:
    Number of documents deleted
  Throws:
    `java.lang.IllegalArgumentException` - If sTableName is not one of { k_bugs, k_newsmsgs, k_mime_msgs }
    `java.lang.NoSuchFieldException` - If luceneindex property is not found at oProps
    `java.lang.IllegalAccessException`
    `java.io.IOException`
    `java.lang.NullPointerException` - If sGuid is null

### main

    public static void main(java.lang.String[] argv)
                     throws java.sql.SQLException,
                            java.io.IOException,
                            java.lang.ClassNotFoundException,
                            java.lang.IllegalArgumentException,
                            java.lang.NoSuchFieldException,
                            java.lang.IllegalAccessException,
                            java.lang.InstantiationException

  Static method for calling indexer from the command line

  Parameters:
    `argv` - String[] Must have two arguments, the first one is the full path to hipergate.cnf or other properties file containing database connection parameters.
    The second argument must be "rebuild".
    The third argument is one of {k_bugs|k_newsmsgs|k_mime_msgs} indicating which table index is to be rebuilt.
    Command line example: java -cp ... com.knowgate.lucene.Indexer /etc/hipergate.cnf rebuild k_mime_msgs
  Throws:
    `java.sql.SQLException`
    `java.io.IOException`
    `java.lang.ClassNotFoundException`
    `java.lang.IllegalArgumentException`
    `java.lang.NoSuchFieldException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD