public class FullTextTrigger extends java.lang.Object implements org.h2.api.Trigger, TransactionalDb.TransactionCallback
Constructor and Description |
---|
FullTextTrigger() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the trigger (Trigger interface)
|
void |
commit()
Commit the table changes for the current transaction (TransactionCallback interface)
|
static void |
createIndex(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table,
java.lang.String columnList)
Create the fulltext index for a table
|
static void |
dropAll(java.sql.Connection conn)
Drop all fulltext indexes
|
static void |
dropIndex(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table)
Drop the fulltext index for a table
|
void |
fire(java.sql.Connection conn,
java.lang.Object[] oldRow,
java.lang.Object[] newRow)
Trigger has fired (Trigger interface)
|
static void |
init()
Initialize the fulltext support for a new database
This method should be called from NxtDbVersion when performing the database version update
that enables NRS fulltext search support
|
void |
init(java.sql.Connection conn,
java.lang.String schema,
java.lang.String trigger,
java.lang.String table,
boolean before,
int type)
Initialize the trigger (Trigger interface)
|
static void |
reindex(java.sql.Connection conn)
Reindex all of the indexed tables
|
void |
remove()
Remove the trigger (Trigger interface)
|
void |
rollback()
Discard the table changes for the current transaction (TransactionCallback interface)
|
static java.sql.ResultSet |
search(java.sql.Connection conn,
java.lang.String schema,
java.lang.String table,
java.lang.String queryText,
int limit,
int offset)
Search the Lucene index
The result set will have the following columns:
SCHEMA - Schema name (String)
TABLE - Table name (String)
COLUMNS - Primary key column names (String[]) - this is always DB_ID
KEYS - Primary key values (Long[]) - this is always the DB_ID value for the table row
SCORE - Lucene score (Float)
|
static void |
setActive(boolean active)
This method is called by NRS initialization to indicate NRS is active.
|
public static void setActive(boolean active)
active
- TRUE to enable database triggerspublic static void init()
public static void reindex(java.sql.Connection conn) throws java.sql.SQLException
conn
- SQL connectionjava.sql.SQLException
- Unable to reindex tablespublic static void createIndex(java.sql.Connection conn, java.lang.String schema, java.lang.String table, java.lang.String columnList) throws java.sql.SQLException
conn
- SQL connectionschema
- Schema nametable
- Table namecolumnList
- Indexed column names separated by commasjava.sql.SQLException
- Unable to create fulltext indexpublic static void dropIndex(java.sql.Connection conn, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
conn
- SQL connectionschema
- Schema nametable
- Table namejava.sql.SQLException
- Unable to drop fulltext indexpublic static void dropAll(java.sql.Connection conn) throws java.sql.SQLException
conn
- SQL connectionjava.sql.SQLException
- Unable to drop fulltext indexespublic static java.sql.ResultSet search(java.sql.Connection conn, java.lang.String schema, java.lang.String table, java.lang.String queryText, int limit, int offset) throws java.sql.SQLException
conn
- SQL connectionschema
- Schema nametable
- Table namequeryText
- Query expressionlimit
- Number of rows to returnoffset
- Offset with result setjava.sql.SQLException
- Unable to search the indexpublic void init(java.sql.Connection conn, java.lang.String schema, java.lang.String trigger, java.lang.String table, boolean before, int type) throws java.sql.SQLException
init
in interface org.h2.api.Trigger
conn
- Database connectionschema
- Database schema nametrigger
- Database trigger nametable
- Database table namebefore
- TRUE if trigger is called before database operationtype
- Trigger typejava.sql.SQLException
- A SQL error occurredpublic void close() throws java.sql.SQLException
close
in interface org.h2.api.Trigger
java.sql.SQLException
- A SQL error occurredpublic void remove() throws java.sql.SQLException
remove
in interface org.h2.api.Trigger
java.sql.SQLException
- A SQL error occurredpublic void fire(java.sql.Connection conn, java.lang.Object[] oldRow, java.lang.Object[] newRow) throws java.sql.SQLException
fire
in interface org.h2.api.Trigger
conn
- Database connectionoldRow
- The old row or nullnewRow
- The new row or nulljava.sql.SQLException
- A SQL error occurredpublic void commit()
commit
in interface TransactionalDb.TransactionCallback
public void rollback()
rollback
in interface TransactionalDb.TransactionCallback