public class FullTextLucene extends FullText
Modifier and Type | Class and Description |
---|---|
static class |
FullTextLucene.FullTextTrigger
Trigger updates the index when a inserting, updating, or deleting a row.
|
Modifier and Type | Field and Description |
---|---|
protected static boolean |
STORE_DOCUMENT_TEXT_IN_INDEX
Whether the text content should be stored in the Lucene index.
|
Constructor and Description |
---|
FullTextLucene() |
Modifier and Type | Method and Description |
---|---|
protected static java.sql.SQLException |
convertException(java.lang.Exception e)
Convert an exception to a fulltext exception.
|
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.
|
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 org.h2.fulltext.FullTextLucene.IndexAccess |
getIndexAccess(java.sql.Connection conn)
Get the index writer/searcher wrapper for the given connection.
|
protected static java.lang.String |
getIndexPath(java.sql.Connection conn)
Get the path of the Lucene index for this database.
|
static void |
init(java.sql.Connection conn)
Initializes full text search functionality for this database.
|
static void |
reindex(java.sql.Connection conn)
Re-creates the full text index for this database.
|
protected static void |
removeIndexAccess(java.lang.String indexPath)
Close the index writer and searcher and remove them from the index access
set.
|
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.
|
addWords, addWords, asString, closeAll, createResultSet, hasChanged, parseKey, quoteSQL, removeAllTriggers, setColumns, setIgnoreList, setWhitespaceChars, throwException
protected static final boolean STORE_DOCUMENT_TEXT_IN_INDEX
public static void init(java.sql.Connection conn) throws java.sql.SQLException
CREATE ALIAS IF NOT EXISTS FTL_INIT FOR "org.h2.fulltext.FullTextLucene.init"; CALL FTL_INIT();
conn
- the connectionjava.sql.SQLException
- on failurepublic 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
- on failurepublic 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
- on failurepublic static void reindex(java.sql.Connection conn) throws java.sql.SQLException
conn
- the connectionjava.sql.SQLException
- on failurepublic static void dropAll(java.sql.Connection conn) throws java.sql.SQLException
conn
- the connectionjava.sql.SQLException
- on failurepublic 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 offsetjava.sql.SQLException
- on failurepublic 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 offsetjava.sql.SQLException
- on failureprotected static java.sql.SQLException convertException(java.lang.Exception e)
e
- the original exceptionprotected static org.h2.fulltext.FullTextLucene.IndexAccess getIndexAccess(java.sql.Connection conn) throws java.sql.SQLException
conn
- the connectionjava.sql.SQLException
- on failureprotected static java.lang.String getIndexPath(java.sql.Connection conn) throws java.sql.SQLException
conn
- the database connectionjava.sql.SQLException
- on failureprotected static void removeIndexAccess(java.lang.String indexPath) throws java.sql.SQLException
indexPath
- the index pathjava.sql.SQLException
- on failureprotected 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 returnedjava.sql.SQLException
- on failure