public class H2Fulltext extends Object
Modifier and Type | Class and Description |
---|---|
static class |
H2Fulltext.Trigger
Trigger used to update the lucene index upon row change.
|
Modifier and Type | Method and Description |
---|---|
static void |
createIndex(Connection conn,
String indexName,
String schema,
String table,
String columns,
String analyzer)
Creates a fulltext index for a table and column list.
|
static void |
dropAll(Connection conn)
Drops all fulltext indexes from the database.
|
static void |
init(Connection conn)
Initializes fulltext search functionality for this database.
|
static void |
reindex(Connection conn)
Re-creates the fulltext index for this database.
|
static ResultSet |
search(Connection conn,
String indexName,
String text)
Searches from the given full text index.
|
public static void init(Connection conn) throws SQLException
CREATE ALIAS IF NOT EXISTS NXFT_INIT FOR "org.nuxeo.ecm.core.storage.sql.db.H2Fulltext.init"; CALL NXFT_INIT();
conn
- SQLException
public static void createIndex(Connection conn, String indexName, String schema, String table, String columns, String analyzer) throws SQLException
A table may have any number of indexes at a time, but the index name must be unique. If the index already exists, nothing is done, otherwise the index is created and populated from existing data.
Usually called through:
CALL NXFT_CREATE_INDEX('indexname', 'myschema', 'mytable', ('col1', 'col2'), 'lucene.analyzer');
conn
- the connectionindexName
- the index nameschema
- the schema name of the tabletable
- the table namecolumns
- the column listanalyzer
- the Lucene fulltext analyzer classSQLException
public static void reindex(Connection conn) throws SQLException
SQLException
public static void dropAll(Connection conn) throws SQLException
SQLException
public static ResultSet search(Connection conn, String indexName, String text) throws SQLException
Usually called through:
SELECT * FROM NXFT_SEARCH(name, 'text');
conn
- the connectionindexName
- the index nametext
- the search querySQLException
Copyright © 2015 Nuxeo SA. All rights reserved.