|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.h2.fulltext.FullText
public class FullText
This class implements the native full text search. Most methods can be called using SQL statements as well.
| Nested Class Summary | |
|---|---|
static class |
FullText.FullTextTrigger
Trigger updates the index when a inserting, updating, or deleting a row. |
| Constructor Summary | |
|---|---|
FullText()
|
|
| Method Summary | |
|---|---|
protected static void |
addWords(FullTextSettings setting,
java.util.HashSet<java.lang.String> set,
java.io.Reader reader)
Add all words in the given text to the hash set. |
protected static void |
addWords(FullTextSettings setting,
java.util.HashSet<java.lang.String> set,
java.lang.String text)
Add all words in the given text to the hash set. |
protected static java.lang.String |
asString(java.lang.Object data,
int type)
INTERNAL. |
static void |
closeAll()
INTERNAL Close all fulltext settings, freeing up memory. |
static void |
createIndex(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table,
java.lang.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(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table)
Create the trigger. |
static void |
dropAll(java.sql.Connection conn)
Drops all full text indexes from the database. |
static void |
dropIndex(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table)
Drop an existing full text index for a table. |
protected static boolean |
hasChanged(java.lang.Object[] oldRow,
java.lang.Object[] newRow,
int[] indexColumns)
Check if a the indexed columns of a row probably have changed. |
protected static void |
indexExistingRows(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table)
Add the existing data to the index. |
static void |
init(java.sql.Connection conn)
Initializes full text search functionality for this database. |
protected static java.lang.Object[][] |
parseKey(java.sql.Connection conn,
java.lang.String key)
Parse a primary key condition into the primary key columns. |
protected static java.lang.String |
quoteSQL(java.lang.Object data,
int type)
INTERNAL. |
static void |
reindex(java.sql.Connection conn)
Re-creates the full text index for this database. |
protected static void |
removeAllTriggers(java.sql.Connection conn,
java.lang.String prefix)
Remove all triggers that start with the given prefix. |
static java.sql.ResultSet |
search(java.sql.Connection conn,
java.lang.String text,
int limit,
int offset)
Searches from the full text index for this database. |
protected static java.sql.ResultSet |
search(java.sql.Connection conn,
java.lang.String text,
int limit,
int offset,
boolean data)
Do the search. |
static java.sql.ResultSet |
searchData(java.sql.Connection conn,
java.lang.String text,
int limit,
int offset)
Searches from the full text index for this database. |
protected static void |
setColumns(int[] index,
java.util.ArrayList<java.lang.String> keys,
java.util.ArrayList<java.lang.String> columns)
Set the column indices of a set of keys. |
static void |
setIgnoreList(java.sql.Connection conn,
java.lang.String commaSeparatedList)
Change the ignore list. |
static void |
setWhitespaceChars(java.sql.Connection conn,
java.lang.String whitespaceChars)
Change the whitespace characters. |
protected static java.sql.SQLException |
throwException(java.lang.String message)
Throw a SQLException with the given message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FullText()
| Method Detail |
|---|
public static void init(java.sql.Connection conn)
throws java.sql.SQLException
CREATE ALIAS IF NOT EXISTS FT_INIT FOR
"org.h2.fulltext.FullText.init";
CALL FT_INIT();
conn - the connection
java.sql.SQLException
public static void createIndex(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table,
java.lang.String columnList)
throws java.sql.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)
java.sql.SQLException
public static void reindex(java.sql.Connection conn)
throws java.sql.SQLException
conn - the connection
java.sql.SQLException
public static void dropIndex(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table)
throws java.sql.SQLException
conn - the connectionschema - the schema name of the table (case sensitive)table - the table name (case sensitive)
java.sql.SQLException
public static void dropAll(java.sql.Connection conn)
throws java.sql.SQLException
conn - the connection
java.sql.SQLException
public static java.sql.ResultSet search(java.sql.Connection conn,
java.lang.String text,
int limit,
int offset)
throws java.sql.SQLException
conn - the connectiontext - the search querylimit - the maximum number of rows or 0 for no limitoffset - the offset or 0 for no offset
java.sql.SQLException
public static java.sql.ResultSet searchData(java.sql.Connection conn,
java.lang.String text,
int limit,
int offset)
throws java.sql.SQLException
conn - the connectiontext - the search querylimit - the maximum number of rows or 0 for no limitoffset - the offset or 0 for no offset
java.sql.SQLException
public static void setIgnoreList(java.sql.Connection conn,
java.lang.String commaSeparatedList)
throws java.sql.SQLException
conn - the connectioncommaSeparatedList - the list
java.sql.SQLException
public static void setWhitespaceChars(java.sql.Connection conn,
java.lang.String whitespaceChars)
throws java.sql.SQLException
conn - the connectionwhitespaceChars - the list of characters
java.sql.SQLException
protected static java.lang.String asString(java.lang.Object data,
int type)
throws java.sql.SQLException
data - the objecttype - the SQL type
java.sql.SQLExceptionprotected static SimpleResultSet createResultSet(boolean data)
data - true if the result set should contain the primary key data as
an array.
protected static java.lang.Object[][] parseKey(java.sql.Connection conn,
java.lang.String key)
conn - the database connectionkey - the primary key condition as a string
protected static java.lang.String quoteSQL(java.lang.Object data,
int type)
throws java.sql.SQLException
data - the objecttype - the SQL type
java.sql.SQLException
protected static void removeAllTriggers(java.sql.Connection conn,
java.lang.String prefix)
throws java.sql.SQLException
conn - the database connectionprefix - the prefix
java.sql.SQLException
protected static void setColumns(int[] index,
java.util.ArrayList<java.lang.String> keys,
java.util.ArrayList<java.lang.String> columns)
throws java.sql.SQLException
index - the column indices (will be modified)keys - the key listcolumns - the column list
java.sql.SQLException
protected static java.sql.ResultSet search(java.sql.Connection conn,
java.lang.String text,
int limit,
int offset,
boolean data)
throws java.sql.SQLException
conn - the database connectiontext - the querylimit - the limitoffset - the offsetdata - whether the raw data should be returned
java.sql.SQLException
protected static void addWords(FullTextSettings setting,
java.util.HashSet<java.lang.String> set,
java.io.Reader reader)
setting - the fulltext settingsset - the hash setreader - the reader
protected static void addWords(FullTextSettings setting,
java.util.HashSet<java.lang.String> set,
java.lang.String text)
setting - the fulltext settingsset - the hash settext - the text
protected static void createTrigger(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table)
throws java.sql.SQLException
conn - the database connectionschema - the schema nametable - the table name
java.sql.SQLException
protected static void indexExistingRows(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table)
throws java.sql.SQLException
conn - the database connectionschema - the schema nametable - the table name
java.sql.SQLException
protected static boolean hasChanged(java.lang.Object[] oldRow,
java.lang.Object[] newRow,
int[] indexColumns)
oldRow - the old rownewRow - the new rowindexColumns - the indexed columns
public static void closeAll()
protected static java.sql.SQLException throwException(java.lang.String message)
throws java.sql.SQLException
message - the message
java.sql.SQLException - the exception
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||