public class FullText extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FullText.FullTextTrigger
Trigger updates the index when a inserting, updating, or deleting a row.
|
| Constructor and Description |
|---|
FullText() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
addWords(FullTextSettings setting,
HashSet<String> set,
Reader reader)
Add all words in the given text to the hash set.
|
protected static void |
addWords(FullTextSettings setting,
HashSet<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.
|
protected static void |
createTrigger(Connection conn,
String schema,
String table)
Create the trigger.
|
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.
|
protected static void |
indexExistingRows(Connection conn,
String schema,
String table)
Add the existing data to the index.
|
static void |
init(Connection conn)
Initializes full text search functionality for this database.
|
protected static Object[][] |
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 connectionSQLExceptionpublic 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)SQLExceptionpublic static void reindex(Connection conn) throws SQLException
conn - the connectionSQLExceptionpublic 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)SQLExceptionpublic static void dropAll(Connection conn) throws SQLException
conn - the connectionSQLExceptionpublic 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 offsetSQLExceptionpublic 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 offsetSQLExceptionpublic static void setIgnoreList(Connection conn, String commaSeparatedList) throws SQLException
conn - the connectioncommaSeparatedList - the listSQLExceptionpublic static void setWhitespaceChars(Connection conn, String whitespaceChars) throws SQLException
conn - the connectionwhitespaceChars - the list of charactersSQLExceptionprotected static String asString(Object data, int type) throws SQLException
data - the objecttype - the SQL typeSQLExceptionprotected static SimpleResultSet createResultSet(boolean data)
data - true if the result set should contain the primary key data as
an array.protected static Object[][] 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 typeSQLExceptionprotected static void removeAllTriggers(Connection conn, String prefix) throws SQLException
conn - the database connectionprefix - the prefixSQLExceptionprotected 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 listSQLExceptionprotected 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 returnedSQLExceptionprotected static void addWords(FullTextSettings setting, HashSet<String> set, Reader reader)
setting - the fulltext settingsset - the hash setreader - the readerprotected static void addWords(FullTextSettings setting, HashSet<String> set, String text)
setting - the fulltext settingsset - the hash settext - the textprotected static void createTrigger(Connection conn, String schema, String table) throws SQLException
conn - the database connectionschema - the schema nametable - the table nameSQLExceptionprotected static void indexExistingRows(Connection conn, String schema, String table) throws SQLException
conn - the database connectionschema - the schema nametable - the table nameSQLExceptionprotected 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 © 2012 JBoss by Red Hat. All Rights Reserved.