Progress
Programming
Handbook


Understanding the CONTAINS Operator, Word Indexes, and Word-break Tables

To process queries containing the CONTAINS operator, Progress uses word indexes. Similarly, to create, maintain, and use word indexes, Progress uses word-break tables. Let us examine this relationship chain one link at a time.

The CONTAINS Operator and Word Indexes

For Progress to process a query that uses the CONTAINS operator, the field mentioned in the WHERE option must participate in a word index. For example, to process the following query:

FOR EACH item WHERE cat-description CONTAINS "hockey": 
  DISPLAY item. 
END. 

Progress looks for the word indexes associated with the item record and its cat–description field. If no such word indexes are found, Progress reports a run-time error. Otherwise, Progress uses the word indexes to retrieve the item records whose cat–description field contains the string "hockey."

Word Indexes and Word-break Tables

In order for Progress to use word indexes, it must first build and maintain them, which it does as you add, delete, and modify records that have fields that participate in them. Consider the sports database’s item table, whose cat–description field participates in a word index. Every time an item record is added, Progress examines the contents of the cat–description field, breaks it down into individual words, and, for each individual word, creates or modifies a word index. To break down the contents of a field into individual words, Progress must know which characters act as word delimiters. To get this information, Progress consults the database’s word-break table, which lists characters and describes the word-delimiting properties of each.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095