Package org.h2.fulltext
Class FullTextSettings
java.lang.Object
org.h2.fulltext.FullTextSettings
The global settings of a full text search.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final WeakHashMap<Connection, SoftValuesHashMap<String, PreparedStatement>> The prepared statement cache.The set of words not to index (stop words).private final ConcurrentHashMap<Integer, IndexInfo> The set of indexes in this database.private booleanWhether this instance has been initialized.private static final HashMap<String, FullTextSettings> The settings of open indexes.private StringThe whitespace characters.The set of words / terms. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIgnored(Iterable<String> words) Amend set of ignored words(package private) voidaddIndexInfo(IndexInfo index) Add an index.voidRegister searchable wordvoidClear set of ignored wordsvoidClear set of searchable wordsprotected static voidcloseAll()Close all fulltext settings, freeing up memory.(package private) StringconvertWord(String word) Convert a word to uppercase.(package private) IndexInfogetIndexInfo(int indexId) Get the index information for the given index id.private static StringgetIndexPath(Connection conn) Get the file system path.(package private) static FullTextSettingsgetInstance(Connection conn) Get or create the fulltext settings for this database.protected StringGet id for a searchable wordprotected booleanGet the initialized flag.private static StringnormalizeWord(String word) (package private) PreparedStatementprepare(Connection conn, String sql) Prepare a statement.protected voidRemove all indexes from the settings.protected voidremoveIndexInfo(IndexInfo index) Remove an index from the settings.protected voidsetInitialized(boolean b) Set the initialized flag.protected voidsetWhitespaceChars(String whitespaceChars)
-
Field Details
-
SETTINGS
The settings of open indexes. -
initialized
private boolean initializedWhether this instance has been initialized. -
ignoreList
The set of words not to index (stop words). -
words
The set of words / terms. -
indexes
The set of indexes in this database. -
cache
The prepared statement cache. -
whitespaceChars
The whitespace characters.
-
-
Constructor Details
-
FullTextSettings
private FullTextSettings()Create a new instance.
-
-
Method Details
-
clearIgnored
public void clearIgnored()Clear set of ignored words -
addIgnored
Amend set of ignored words- Parameters:
words- to add
-
clearWordList
public void clearWordList()Clear set of searchable words -
getWordId
Get id for a searchable word- Parameters:
word- to find id for- Returns:
- Integer id or null if word is not found
-
addWord
Register searchable word- Parameters:
word- to registerid- to register with
-
getIndexInfo
Get the index information for the given index id.- Parameters:
indexId- the index id- Returns:
- the index info
-
addIndexInfo
Add an index.- Parameters:
index- the index
-
convertWord
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
Get or create the fulltext settings for this database.- Parameters:
conn- the connection- Returns:
- the settings
- Throws:
SQLException- on failure
-
getIndexPath
Get the file system path.- Parameters:
conn- the connection- Returns:
- the file system path
- Throws:
SQLException
-
prepare
Prepare a statement. The statement is cached in a soft reference cache.- Parameters:
conn- the connectionsql- the statement- Returns:
- the prepared statement
- Throws:
SQLException- on failure
-
removeAllIndexes
protected void removeAllIndexes()Remove all indexes from the settings. -
removeIndexInfo
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. -
setWhitespaceChars
-
getWhitespaceChars
-
normalizeWord
-