org.h2.fulltext
Class FullTextSettings

java.lang.Object
  extended by org.h2.fulltext.FullTextSettings

public class FullTextSettings
extends java.lang.Object

The global settings of a full text search.


Field Summary
protected  SoftHashMap<java.sql.Connection,SoftHashMap<java.lang.String,java.sql.PreparedStatement>> cache
          The prepared statement cache.
protected  java.util.HashSet<java.lang.String> ignoreList
          The set of words not to index (stop words).
protected  java.util.HashMap<java.lang.Integer,IndexInfo> indexes
          The set of indexes in this database.
protected  boolean initialized
          Whether this instance has been initialized.
protected static java.util.HashMap<java.lang.String,FullTextSettings> SETTINGS
          The settings of open indexes.
protected  java.util.HashMap<java.lang.String,java.lang.Integer> words
          The set of words / terms.
 
Constructor Summary
protected FullTextSettings()
          Create a new instance.
 
Method Summary
protected  void addIndexInfo(IndexInfo index)
          Add an index.
protected static void closeAll()
          Close all fulltext settings, freeing up memory.
protected  java.lang.String convertWord(java.lang.String word)
          Convert a word to uppercase.
protected  java.util.HashSet<java.lang.String> getIgnoreList()
          Get the ignore list.
protected  IndexInfo getIndexInfo(int indexId)
          Get the index information for the given index id.
protected static java.lang.String getIndexPath(java.sql.Connection conn)
          Get the file system path.
protected static FullTextSettings getInstance(java.sql.Connection conn)
          Get or create the fulltext settings for this database.
protected  java.util.HashMap<java.lang.String,java.lang.Integer> getWordList()
          Get the word list.
protected  boolean isInitialized()
          Get the initialized flag.
protected  java.sql.PreparedStatement prepare(java.sql.Connection conn, java.lang.String sql)
          Prepare a statement.
protected  void removeAllIndexes()
          Remove all indexes from the settings.
protected  void removeIndexInfo(IndexInfo index)
          Remove an index from the settings.
protected  void setInitialized(boolean b)
          Set the initialized flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SETTINGS

protected static final java.util.HashMap<java.lang.String,FullTextSettings> SETTINGS
The settings of open indexes.


initialized

protected boolean initialized
Whether this instance has been initialized.


ignoreList

protected java.util.HashSet<java.lang.String> ignoreList
The set of words not to index (stop words).


words

protected java.util.HashMap<java.lang.String,java.lang.Integer> words
The set of words / terms.


indexes

protected java.util.HashMap<java.lang.Integer,IndexInfo> indexes
The set of indexes in this database.


cache

protected SoftHashMap<java.sql.Connection,SoftHashMap<java.lang.String,java.sql.PreparedStatement>> cache
The prepared statement cache.

Constructor Detail

FullTextSettings

protected FullTextSettings()
Create a new instance.

Method Detail

getIgnoreList

protected java.util.HashSet<java.lang.String> getIgnoreList()
Get the ignore list.

Returns:
the ignore list

getWordList

protected java.util.HashMap<java.lang.String,java.lang.Integer> getWordList()
Get the word list.

Returns:
the word list

getIndexInfo

protected IndexInfo getIndexInfo(int indexId)
Get the index information for the given index id.

Parameters:
indexId - the index id
Returns:
the index info

addIndexInfo

protected void addIndexInfo(IndexInfo index)
Add an index.

Parameters:
index - the index

convertWord

protected java.lang.String convertWord(java.lang.String word)
Convert a word to uppercase. This method returns null if the word is in the ignore list.

Parameters:
word - the word to convert and check
Returns:
the uppercase version of the word or null

getInstance

protected static FullTextSettings getInstance(java.sql.Connection conn)
                                       throws java.sql.SQLException
Get or create the fulltext settings for this database.

Parameters:
conn - the connection
Returns:
the settings
Throws:
java.sql.SQLException

getIndexPath

protected static java.lang.String getIndexPath(java.sql.Connection conn)
                                        throws java.sql.SQLException
Get the file system path.

Parameters:
conn - the connection
Returns:
the file system path
Throws:
java.sql.SQLException

prepare

protected java.sql.PreparedStatement prepare(java.sql.Connection conn,
                                             java.lang.String sql)
                                      throws java.sql.SQLException
Prepare a statement. The statement is cached in a soft reference cache.

Parameters:
conn - the connection
sql - the statement
Returns:
the prepared statement
Throws:
java.sql.SQLException

removeAllIndexes

protected void removeAllIndexes()
Remove all indexes from the settings.


removeIndexInfo

protected void removeIndexInfo(IndexInfo index)
Remove an index from the settings.

Parameters:
index - the index to remove

setInitialized

protected void setInitialized(boolean b)
Set the initialized flag.

Parameters:
b - the new value

isInitialized

protected boolean isInitialized()
Get the initialized flag.

Returns:
whether this instance is initialized

closeAll

protected static void closeAll()
Close all fulltext settings, freeing up memory.