You issue Text queries using the CONTAINS operator in a SELECT statement. With CONTAINS, you can issue two types of queries:
A word query is a query on the exact word or phrase you enter between the single quotes in the CONTAINS operator.
The following example finds all the documents in the text column that contain the word oracle. The score for each row is selected with the SCORE operator using a label of 1:
SELECT SCORE(1) title from news WHERE CONTAINS(text, 'oracle', 1) > 0;
In a query expression, you can use text operators such as AND and OR to achieve different results. You can also add structured predicates to the WHERE clause.
You can count the hits (matches) to a query using count(*), CTX_QUERY.COUNT_HITS, or CTX_QUERY.EXPLAIN.
ABOUT Query Example
In all languages, ABOUT queries increases the number of relevant documents returned by a query.
In English, ABOUT queries can use the theme component of the index, which is created by default. As such, this operator returns documents based on the concepts of your query, not only the exact word or phrase you specify.
For example, the following query finds all the documents in the text column that are about the subject politics, not just the documents that contain the word politics:
SELECT SCORE(1) title from news WHERE CONTAINS(text, 'about(politics)', 1) > 0;
Section Types and Query Semantics
The operation of queries is affected by whether the section group type is zone or field, which you can specify using the Section Group Attributes tab. For a detailed explanation of section types and examples of queries, see the topic on zone and field section types.
Other Query Features
In a query application, you can use other query features. The Oracle interMedia Text User's Guide and Reference includes information about the following query features: