Atlas now supports Oracle user-defined operators, index types, and domain indexes as first-class resources, enabling declarative management of full-text search indexes (CTXSYS.CONTEXT) and custom ODCI-based indexing infrastructure.
These three resources are closely related: a domain index uses an index_type, an index_type binds operators to an ODCI implementation object, and each operator dispatches to a function or object-type method. Together they make Oracle Text, spatial, and other ODCI-based indexing extensions manageable end-to-end from HCL.
Operators
An operator declares a named operator with one or more bindings. Each binding is backed by a standalone function:
function "COMPARE_NUM" {schema = schema.apparg "A" { type = NUMBER }arg "B" { type = NUMBER }return = NUMBERas = <<-SQLBEGINRETURN 0;END COMPARE_NUM;SQL}operator "CMP_OP" {schema = schema.appbinding {function = function.COMPARE_NUMargs = [NUMBER, NUMBER]return = NUMBER}}
Bindings can also reference static methods on a user-defined object_type:
object_type "CMP_TYPE" {schema = schema.appattribute "VAL" { type = NUMBER }function "COMPARE" {static = truearg "A" { type = CLOB }arg "B" { type = CLOB }return = NUMBERas = <<-SQLBEGINIF DBMS_LOB.COMPARE(a, b) = 0 THEN RETURN 1; ELSE RETURN 0; END IF;END;SQL}}operator "CMP_OP" {schema = schema.appbinding {function = object_type.CMP_TYPE.function.COMPAREargs = [CLOB, CLOB]return = NUMBER}}
Atlas diffs bindings individually, so you can add, drop, or swap bindings on an existing operator without recreating it.
Domain Indexes with Built-In Index Types
Domain indexes use an existing indextype, such as the Oracle Text CTXSYS.CONTEXT. Set the domain attribute on an index block, and optionally provide parameters that are passed to the underlying indextype:
table "DOCUMENTS" {schema = schema.appcolumn "ID" {null = falsetype = NUMBER(10)}column "CONTENT" {null = falsetype = VARCHAR2(4000)}column "TITLE" {null = falsetype = VARCHAR2(255)}primary_key { columns = [column.ID] }index "CTX_CONTENT_IDX" {columns = [column.CONTENT]domain = "\"CTXSYS\".\"CONTEXT\""}index "CTX_TITLE_IDX" {columns = [column.TITLE]domain = "\"CTXSYS\".\"CONTEXT\""parameters = "SYNC (ON COMMIT)"}}
Custom Index Types
The index_type block defines a custom indextype backed by an ODCI implementation object and a list of supported operators. Once declared, it can be referenced from any index via the domain attribute:
index_type "TEXT_IDXTYPE" {schema = schema.appimpl_type = object_type.TEXT_IDX_IMPLoperator {operator = operator.TEXT_CONTAINS_OPparam_types = [VARCHAR2, VARCHAR2]}}table "DOCUMENTS" {schema = schema.appcolumn "ID" { null = false, type = NUMBER(10) }column "KEYWORDS" { null = false, type = VARCHAR2(4000) }primary_key { columns = [column.ID] }index "DOC_KEYWORDS_IDX" {columns = [column.KEYWORDS]domain = index_type.TEXT_IDXTYPE}}
Generated SQL
Atlas resolves the full dependency chain across functions, object types, operators, index types, and domain indexes, and emits the statements in the correct order on create and drop:
-- Create "TEXT_CONTAINS_OP" operatorCREATE OPERATOR "TEXT_CONTAINS_OP"BINDING (VARCHAR2, VARCHAR2) RETURN NUMBER USING "TEXT_CONTAINS";-- Create "TEXT_IDXTYPE" index-typeCREATE INDEXTYPE "TEXT_IDXTYPE"FOR "TEXT_CONTAINS_OP" (VARCHAR2, VARCHAR2)USING "TEXT_IDX_IMPL";-- Create domain indexesCREATE INDEX "CTX_CONTENT_IDX" ON "DOCUMENTS" ("CONTENT")INDEXTYPE IS "CTXSYS"."CONTEXT";CREATE INDEX "CTX_TITLE_IDX" ON "DOCUMENTS" ("TITLE")INDEXTYPE IS "CTXSYS"."CONTEXT" PARAMETERS ('SYNC (ON COMMIT)');CREATE INDEX "DOC_KEYWORDS_IDX" ON "DOCUMENTS" ("KEYWORDS")INDEXTYPE IS "TEXT_IDXTYPE";
On drop, Atlas reverses the order and uses DROP INDEXTYPE ... FORCE and DROP OPERATOR ... FORCE where required, so that removing an entire stack of custom indexing resources works in a single migration.