226 Expression Filter Types

The Expression Filter feature is supplied with a set of predefined types and public synonyms for these types. Most of these types are used for configuring index parameters with the Expression Filter procedural APIs. The EXF$TABLE_ALIAS type is used to support expressions defined on one or more database tables.

The arithmetic expression that constitutes the stored or indexed attribute

attr_oper

The list of common operators in the predicates with the attribute. Default value: EXF$INDEXOPER('all')

attr_indexed

TRUE if the attribute is indexed, else FALSE. Default value: FALSE.

Usage Notes

The EXF$ATTRIBUTE type is used to specify the stored and indexed attributes for an Expression Filter index using the DBMS_EXPFIL.DEFAULT_INDEX_PARAMETERS procedure. When values for attr_oper and attr_indexed fields are omitted during EXF$ATTRIBUTE instantiation, it is considered a stored attribute with a default value for common operators (EXF$INDEXOPER('all')).

Examples

A stored attribute with no preference on the list of common operators is represented as follows:

EXF$INDEXOPER

The EXF$INDEXOPER type is used to specify the list of common operators in predicates with a stored or an indexed attribute.

Syntax

CREATE or REPLACE TYPE EXFSYS.EXF$INDEXOPER as VARRAY(20) of VARCHAR2(15);

The values for the EXF$INDEXOPER array are expected to be from the list in the following table:

Value

Predicate Description

=

Equality predicates

>

Greater than predicates

<

Less than predicates

>=

Greater than or equal to predicates

<=

Less than or equal to predicates

!= or <> or ^=

Not equal to predicates

IS NULL

IS NULL predicates

IS NOT NULL

IS NOT NULL predicates

ALL

All the operators listed in this table starting with the equality predicate through the IS NOT NULL predicate

NVL

Predicates with NVL (equality) operator

LIKE

Predicates with LIKE operator

BETWEEN

BETWEEN predicates

Attributes

None.

Usage Notes

A value of ALL for one of the EXF$INDEXOPER items implies that all the simple operators (=,>,<,>=,<=,!=, IS NULL, IS NOT NULL) are common in the predicates with an attribute. This value can be used along with one or more complex operators (NVL, LIKE and BETWEEN).

A predicate with a BETWEEN operator is treated as two predicates with binary operators, one with '>=' operator and another with '<=' operator. By default, only one of these operators is indexed, and the other operator is evaluated by value substitution. However, if predicates with the BETWEEN operator are common for an attribute (stored or indexed), both the binary operators resulting from the BETWEEN operator can be indexed by specifying BETWEEN in the EXF$INDEXOPER VARRAY. However, because this uses additional space in the predicate table, this operator should be used only when majority of predicates with an attribute use the BETWEEN operator.

When the LIKE operator is chosen as one of the common operators for an attribute, LIKE predicates on that attributes are indexed. Indexing a LIKE operator is beneficial only if the VARCHAR2 constant on the right-hand side of the predicate does not lead with a wild-card character. For example, indexing a LIKE operator will filter the following predicates efficiently:

company LIKE 'General%'
company LIKE 'Proctor%'

But, the following predicates are evaluated as sparse predicates in the last stage:

company LIKE '%Electric'
company LIKE "%Gamble'

Examples

An attribute with a list of common operators is represented as follows:

Text preference specification, such as LEXER, CLASSIFIER, and WORDLIST

Usage Notes

The EXF$TEXT attribute is used to specify the preferences for a text attribute at the time of creation. The preferences specified through the instance of EXF$TEXT type are used in creation of the CTXRULE index for the text predicates. The syntax for the text preference specification is similar to the PARAMETERS clause specified for a CTXRULE Indextype. [See CREATE INDEX syntax for CTXRULE Indextype in Oracle Text Reference, Release 10g Release 2.]

Examples

A text predicate with a LEXER and WORDLIST preferences can be created using the following instance of EXF$TEXT object as follows:

EXF$TEXT ('LEXER insrpt_lexer WORDLIST insrpt_wordlist');

EXF$XPATH_TAG

The EXF$XPATH_TAG type is used to configure an XML element or an XML attribute for indexing a set of XPath predicates.

Name of the XML element or attribute. The name for an XML attribute is formatted as: <ElementName>@<AttributeName>. Optionally, the element name can be prefixed with its namespace URL as in <Namespace URL>:<ElementName>@<AttributeName>.

tag_indexed

TRUE if XML tag is indexed; otherwise FALSE.

Default:

TRUE if the tag is a positional filter.

FALSE if the tag is a value filter.

tag_type

Datatype for the value in the case of value filter. NULL for positional filters.

Usage Notes

EXF$XPATH_TAG type is used to configure an XML element or an attribute as a positional or a value filter for an Expression Filter index (see "Index Tuning for XPath Predicates" in Oracle Database Rules Manager and Expression Filter Developer's Guide). An instance of the EXF$XPATH_TAG type with NULL value for tag_type configures the XML tag as a positional filter. In the current release, the only other possible values for the tag_type attribute are strings (CHAR or VARCHAR) and such tags are configured as value filters. By default, all positional filters are indexed and the value filters are not indexed. This behavior can be overridden by setting a TRUE or FALSE value for the tag_indexed attribute accordingly.

Examples

An XML element can be configured as a positional filter and be indexed using the following instance of the EXF$XPATH_TAG type.