|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.fulltext.FullText
org.h2.fulltext.FullTextLucene
public class FullTextLucene
This class implements the full text search based on Apache Lucene. Most methods can be called using SQL statements as well.
Nested Class Summary | |
---|---|
static class |
FullTextLucene.FullTextTrigger
Trigger updates the index when a inserting, updating, or deleting a row. |
Field Summary | |
---|---|
protected static boolean |
STORE_DOCUMENT_TEXT_IN_INDEX
Whether the text content should be stored in the Lucene index. |
Fields inherited from class org.h2.fulltext.FullText |
---|
FIELD_COLUMNS, FIELD_KEYS, FIELD_SCHEMA, FIELD_SCORE, FIELD_TABLE |
Constructor Summary | |
---|---|
FullTextLucene()
|
Method Summary | |
---|---|
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. |
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. |
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. |
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. |
static void |
reindex(java.sql.Connection conn)
Re-creates the full text index for this database. |
protected static void |
removeIndexAccess(org.h2.fulltext.FullTextLucene.IndexAccess access,
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. |
Methods inherited from class org.h2.fulltext.FullText |
---|
addWords, addWords, asString, closeAll, createResultSet, dropIndex, hasChanged, parseKey, quoteSQL, removeAllTriggers, setColumns, setIgnoreList, throwException |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final boolean STORE_DOCUMENT_TEXT_IN_INDEX
Constructor Detail |
---|
public FullTextLucene()
Method Detail |
---|
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 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 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
protected static java.sql.SQLException convertException(java.lang.Exception e)
e
- the original exception
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 org.h2.fulltext.FullTextLucene.IndexAccess getIndexAccess(java.sql.Connection conn) throws java.sql.SQLException
conn
- the connection
java.sql.SQLException
protected static java.lang.String getIndexPath(java.sql.Connection conn) throws java.sql.SQLException
conn
- the database connection
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 void removeIndexAccess(org.h2.fulltext.FullTextLucene.IndexAccess access, java.lang.String indexPath) throws java.sql.SQLException
access
- the index writer/searcher wrapperindexPath
- the index path
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |