public class FullText extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
FullText.FullTextTrigger
Trigger updates the index when a inserting, updating, or deleting a row.
|
| 构造器和说明 |
|---|
FullText() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected static void |
addWords(org.h2.fulltext.FullTextSettings setting,
Set<String> set,
Reader reader)
Add all words in the given text to the hash set.
|
protected static void |
addWords(org.h2.fulltext.FullTextSettings setting,
Set<String> set,
String text)
Add all words in the given text to the hash set.
|
protected static String |
asString(Object data,
int type)
INTERNAL.
|
static void |
closeAll()
INTERNAL
Close all fulltext settings, freeing up memory.
|
static void |
createIndex(Connection conn,
String schema,
String table,
String columnList)
Create a new full text index for a table and column list.
|
protected static SimpleResultSet |
createResultSet(boolean data)
Create an empty search result and initialize the columns.
|
static void |
dropAll(Connection conn)
Drops all full text indexes from the database.
|
static void |
dropIndex(Connection conn,
String schema,
String table)
Drop an existing full text index for a table.
|
protected static boolean |
hasChanged(Object[] oldRow,
Object[] newRow,
int[] indexColumns)
Check if a the indexed columns of a row probably have changed.
|
static void |
init(Connection conn)
Initializes full text search functionality for this database.
|
protected static String[][] |
parseKey(Connection conn,
String key)
Parse a primary key condition into the primary key columns.
|
protected static String |
quoteSQL(Object data,
int type)
INTERNAL.
|
static void |
reindex(Connection conn)
Re-creates the full text index for this database.
|
protected static void |
removeAllTriggers(Connection conn,
String prefix)
Remove all triggers that start with the given prefix.
|
static ResultSet |
search(Connection conn,
String text,
int limit,
int offset)
Searches from the full text index for this database.
|
protected static ResultSet |
search(Connection conn,
String text,
int limit,
int offset,
boolean data)
Do the search.
|
static ResultSet |
searchData(Connection conn,
String text,
int limit,
int offset)
Searches from the full text index for this database.
|
protected static void |
setColumns(int[] index,
ArrayList<String> keys,
ArrayList<String> columns)
Set the column indices of a set of keys.
|
static void |
setIgnoreList(Connection conn,
String commaSeparatedList)
Change the ignore list.
|
static void |
setWhitespaceChars(Connection conn,
String whitespaceChars)
Change the whitespace characters.
|
protected static SQLException |
throwException(String message)
Throw a SQLException with the given message.
|
public static void init(Connection conn) throws SQLException
CREATE ALIAS IF NOT EXISTS FT_INIT FOR
"org.h2.fulltext.FullText.init";
CALL FT_INIT();
conn - the connectionSQLException - on failurepublic static void createIndex(Connection conn, String schema, String table, String columnList) throws SQLException
conn - the connectionschema - the schema name of the table (case sensitive)table - the table name (case sensitive)columnList - the column list (null for all columns)SQLException - on failurepublic static void reindex(Connection conn) throws SQLException
conn - the connectionSQLException - on failurepublic static void dropIndex(Connection conn, String schema, String table) throws SQLException
conn - the connectionschema - the schema name of the table (case sensitive)table - the table name (case sensitive)SQLException - on failurepublic static void dropAll(Connection conn) throws SQLException
conn - the connectionSQLException - on failurepublic static ResultSet search(Connection conn, String text, int limit, int offset) throws SQLException
conn - the connectiontext - the search querylimit - the maximum number of rows or 0 for no limitoffset - the offset or 0 for no offsetSQLException - on failurepublic static ResultSet searchData(Connection conn, String text, int limit, int offset) throws SQLException
conn - the connectiontext - the search querylimit - the maximum number of rows or 0 for no limitoffset - the offset or 0 for no offsetSQLException - on failurepublic static void setIgnoreList(Connection conn, String commaSeparatedList) throws SQLException
conn - the connectioncommaSeparatedList - the listSQLException - on failurepublic static void setWhitespaceChars(Connection conn, String whitespaceChars) throws SQLException
conn - the connectionwhitespaceChars - the list of charactersSQLException - on failureprotected static String asString(Object data, int type) throws SQLException
data - the objecttype - the SQL typeSQLException - on failureprotected static SimpleResultSet createResultSet(boolean data)
data - true if the result set should contain the primary key data as
an array.protected static String[][] parseKey(Connection conn, String key)
conn - the database connectionkey - the primary key condition as a stringprotected static String quoteSQL(Object data, int type) throws SQLException
data - the objecttype - the SQL typeSQLException - on failureprotected static void removeAllTriggers(Connection conn, String prefix) throws SQLException
conn - the database connectionprefix - the prefixSQLException - on failureprotected static void setColumns(int[] index,
ArrayList<String> keys,
ArrayList<String> columns)
throws SQLException
index - the column indices (will be modified)keys - the key listcolumns - the column listSQLException - on failureprotected static ResultSet search(Connection conn, String text, int limit, int offset, boolean data) throws SQLException
conn - the database connectiontext - the querylimit - the limitoffset - the offsetdata - whether the raw data should be returnedSQLException - on failureprotected static void addWords(org.h2.fulltext.FullTextSettings setting,
Set<String> set,
Reader reader)
setting - the fulltext settingsset - the hash setreader - the readerprotected static void addWords(org.h2.fulltext.FullTextSettings setting,
Set<String> set,
String text)
setting - the fulltext settingsset - the hash settext - the textprotected static boolean hasChanged(Object[] oldRow, Object[] newRow, int[] indexColumns)
oldRow - the old rownewRow - the new rowindexColumns - the indexed columnspublic static void closeAll()
protected static SQLException throwException(String message) throws SQLException
message - the messageSQLException - the exceptionCopyright © 2022. All rights reserved.