OBKV-Table supports DML and query operations on full-text indexes. You can create a full-text index on a table. When data is inserted, updated, or deleted in the table, the index is automatically updated to support full-text search.
Supported scope
The current OBKV-Table client supports the following features:
- String and LOB types.
- Multiple full-text indexes on a single table, and multiple full-text indexes on the same column.
- Partitioned tables.
- The
NATURAL LANGUAGE MODEquery mode. - The following operations of the OBKV-Table client:
- Single operations: PUT is not supported.
- Batch operations: PUT is not supported.
- Group commit and TTL for OBKV-Table.
Examples
Create a full-text index named full_idx1_tbl1 on the tbl1 table:
CREATE TABLE IF NOT EXISTS tbl1(
id INT,
c2 INT,
txt text,
PRIMARY KEY (id),
FULLTEXT INDEX full_idx1_tbl1(txt)
);
Insert data into the tbl1 table:
MutationResult res = client.insert("tbl1").setRowKey(colVal("id", id))
.addMutateRow(row(colVal("txt", "OceanBase AI Database is a native, " +
"enterprise-level distributed database developed independently by the OceanBase AI Database team")))
.execute();
Query data from the tbl1 table:
// Synchronous query
QueryResultSet resultSet = client.query("tbl1")
.setSearchText("oceanbase")
.indexName("full_idx1_tbl1")
.limit(0, 1)
.execute();
// Asynchronous query
QueryResultSet asyncResultSet = client.query("tbl1")
.indexName("full_idx1_tbl1")
.setSearchText("oceanbase")
.limit(0, 1)
.asyncExecute();