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 boolean
Whether this instance has been initialized.private static final HashMap
<String, FullTextSettings> The settings of open indexes.private String
The whitespace characters.The set of words / terms. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIgnored
(Iterable<String> words) Amend set of ignored words(package private) void
addIndexInfo
(IndexInfo index) Add an index.void
Register searchable wordvoid
Clear set of ignored wordsvoid
Clear set of searchable wordsprotected static void
closeAll()
Close all fulltext settings, freeing up memory.(package private) String
convertWord
(String word) Convert a word to uppercase.(package private) IndexInfo
getIndexInfo
(int indexId) Get the index information for the given index id.private static String
getIndexPath
(Connection conn) Get the file system path.(package private) static FullTextSettings
getInstance
(Connection conn) Get or create the fulltext settings for this database.protected String
Get id for a searchable wordprotected boolean
Get the initialized flag.private static String
normalizeWord
(String word) (package private) PreparedStatement
prepare
(Connection conn, String sql) Prepare a statement.protected void
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.protected void
setWhitespaceChars
(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
-