Top Description Fields Constructors Methods
org.h2.fulltext

pack-priv final Class FullTextSettings

extends Object
Class Inheritance
Imports
java.sql.Connection, .PreparedStatement, .ResultSet, .SQLException, .Statement, java.util.HashMap, .HashSet, .WeakHashMap, java.util.concurrent.ConcurrentHashMap, org.h2.util.SoftValuesHashMap

The global settings of a full text search.

Field Summary

Modifier and TypeField and Description
private final WeakHashMap<Connection, SoftValuesHashMap<String, PreparedStatement>>
cache

The prepared statement cache.

private final HashSet<String>
ignoreList

The set of words not to index (stop words).

private final ConcurrentHashMap<Integer, IndexInfo>
indexes

The set of indexes in this database.

private boolean
initialized

Whether this instance has been initialized.

private static final HashMap<String, FullTextSettings>
SETTINGS

The settings of open indexes.

private String
whitespaceChars

The whitespace characters.

private final HashMap<String, Integer>
words

The set of words / terms.

Constructor Summary

AccessConstructor and Description
private
FullTextSettings()

Create a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
addIgnored(Iterable<String>
to add
words
)

Amend set of ignored words

pack-priv void
addIndexInfo(IndexInfo
the index
index
)

Add an index.

public void
addWord(String
to register
word
,
Integer
to register with
id
)

Register searchable word

public void
clearIgnored()

Clear set of ignored words

public void
clearWordList()

Clear set of searchable words

pack-priv static void
closeAll()

Close all fulltext settings, freeing up memory.

pack-priv String

Returns:

the uppercase version of the word or null
convertWord
(String
the word to convert and check
word
)

Convert a word to uppercase.

pack-priv IndexInfo

Returns:

the index info
getIndexInfo
(int
the index id
indexId
)

Get the index information for the given index id.

private static String

Returns:

the file system path
getIndexPath
(Connection
the connection
conn
)

Get the file system path.

pack-priv static FullTextSettings

Returns:

the settings
getInstance
(Connection
the connection
conn
)

Get or create the fulltext settings for this database.

pack-priv String
public Integer

Returns:

Integer id or null if word is not found
getWordId
(String
to find id for
word
)

Get id for a searchable word

pack-priv boolean

Returns:

whether this instance is initialized
isInitialized
()

Get the initialized flag.

private static String
pack-priv synchronized PreparedStatement

Returns:

the prepared statement
prepare
(Connection
the connection
conn
,
String
the statement
sql
)

Prepare a statement.

pack-priv void
removeAllIndexes()

Remove all indexes from the settings.

pack-priv void
removeIndexInfo(IndexInfo
the index to remove
index
)

Remove an index from the settings.

pack-priv void
setInitialized(boolean
the new value
b
)

Set the initialized flag.

pack-priv void
setWhitespaceChars(String whitespaceChars)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
private final WeakHashMap<Connection, SoftValuesHashMap<String, PreparedStatement>> cache

The prepared statement cache.

ignoreListback to summary
private final HashSet<String> ignoreList

The set of words not to index (stop words).

indexesback to summary
private final ConcurrentHashMap<Integer, IndexInfo> indexes

The set of indexes in this database.

initializedback to summary
private boolean initialized

Whether this instance has been initialized.

SETTINGSback to summary
private static final HashMap<String, FullTextSettings> SETTINGS

The settings of open indexes.

whitespaceCharsback to summary
private String whitespaceChars

The whitespace characters.

wordsback to summary
private final HashMap<String, Integer> words

The set of words / terms.

Constructor Detail

FullTextSettingsback to summary
private FullTextSettings()

Create a new instance.

Method Detail

addIgnoredback to summary
public void addIgnored(Iterable<String> words)

Amend set of ignored words

Parameters
words:Iterable<String>

to add

addIndexInfoback to summary
pack-priv void addIndexInfo(IndexInfo index)

Add an index.

Parameters
index:IndexInfo

the index

addWordback to summary
public void addWord(String word, Integer id)

Register searchable word

Parameters
word:String

to register

id:Integer

to register with

clearIgnoredback to summary
public void clearIgnored()

Clear set of ignored words

clearWordListback to summary
public void clearWordList()

Clear set of searchable words

closeAllback to summary
pack-priv static void closeAll()

Close all fulltext settings, freeing up memory.

convertWordback to summary
pack-priv String convertWord(String word)

Convert a word to uppercase. This method returns null if the word is in the ignore list.

Parameters
word:String

the word to convert and check

Returns:String

the uppercase version of the word or null

getIndexInfoback to summary
pack-priv IndexInfo getIndexInfo(int indexId)

Get the index information for the given index id.

Parameters
indexId:int

the index id

Returns:IndexInfo

the index info

getIndexPathback to summary
private static String getIndexPath(Connection conn) throws SQLException

Get the file system path.

Parameters
conn:Connection

the connection

Returns:String

the file system path

getInstanceback to summary
pack-priv static FullTextSettings getInstance(Connection conn) throws SQLException

Get or create the fulltext settings for this database.

Parameters
conn:Connection

the connection

Returns:FullTextSettings

the settings

Exceptions
SQLException:
on failure
getWhitespaceCharsback to summary
pack-priv String getWhitespaceChars()
getWordIdback to summary
public Integer getWordId(String word)

Get id for a searchable word

Parameters
word:String

to find id for

Returns:Integer

Integer id or null if word is not found

isInitializedback to summary
pack-priv boolean isInitialized()

Get the initialized flag.

Returns:boolean

whether this instance is initialized

normalizeWordback to summary
private static String normalizeWord(String word)
prepareback to summary
pack-priv synchronized PreparedStatement prepare(Connection conn, String sql) throws SQLException

Prepare a statement. The statement is cached in a soft reference cache.

Parameters
conn:Connection

the connection

sql:String

the statement

Returns:PreparedStatement

the prepared statement

Exceptions
SQLException:
on failure
removeAllIndexesback to summary
pack-priv void removeAllIndexes()

Remove all indexes from the settings.

removeIndexInfoback to summary
pack-priv void removeIndexInfo(IndexInfo index)

Remove an index from the settings.

Parameters
index:IndexInfo

the index to remove

setInitializedback to summary
pack-priv void setInitialized(boolean b)

Set the initialized flag.

Parameters
b:boolean

the new value

setWhitespaceCharsback to summary
pack-priv void setWhitespaceChars(String whitespaceChars)