Getting Started with interMedia Text

If you have an appropriate system-defined role (CTXSYS or CTXAPP), you can use interMedia Text to enable text queries in a query application. The following is a simple example of using interMedia Text:

  1. Create a table to hold some documents. This example uses one primary key column to identify each document and one small VARCHAR2 column to hold each document.

CREATE TABLE docs (id NUMBER PRIMERY KEY, text VACHAR2(80));

  1. Populate the table with two example documents:

INSERT INTO docs VALUES (1, 'first document');

INSERT INTO docs VALUES (2, 'second document');

COMMIT;

  1. Use this application to create and modify preferences, which will be associated with indexes.

  2. Create a Text index, using the Create or Create Like feature of this application. Alternatively, you could enter a SQL statement such as the following, which uses the default preferences:

CREATE INDEX doc_index ON docs(text)

INDEXTYPE IS CTXSYS.CONTEXT;

  1. Issue content-based queries on the documents, using the CONTAINS function. For example:

SELECT id FROM docs WHERE CONTAINS (text, 'first') > 0;

This will find all rows in docs where the text column contains the word first (which is document 1). The > 0 part of the statement is necessary to make it valid Oracle SQL, which does not support Boolean return values for functions.

Additional information is available about the following topics:

These topics merely get you started, however. To use interMedia Text effectively, you must understand the major concepts. It is also recommended that you have the product documentation available.

See also: Main topics (outline), Major concepts for interMedia Text