Progress
Database Design
Guide


Indexing by Line

To index a set of documents by line, you might create a table called line with three fields: document_name, line_number, and line_text. Define the primary index on document_name and a word index on line_text. Next, write a text loading Progress program that reads each document and creates a line record for each line in the document. To improve storage efficiency, you might replace the document_name field with a document_number field, and create a document table to associate a document_name with each document_number.

You will have to update your index when the base documents change. One method is to store a document ID as part of the record for each line. When a document changes, you can delete all lines with that document ID and reload the document.

The following code queries the line table using the word index:

DEFINE VARIABLE words AS CHAR FORMAT "x(60)"
        LABEL "To find document lines, enter search words".

REPEAT:
    UPDATE words.
    FOR EACH line WHERE line_text CONTAINS words:
      DISPLAY line.
    END.
END. 

The example prompts for a string of words and then displays each line that matches the search criteria.


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