Administration: Omnidex Indexing

Omnidex Text

Retrieving External Files

Omnidex allows a table to point to a collection of external text files. One of the columns in the table can contain the filename of an external text file. When the table is read, the text from the external file is retrieved and presented as a large text column in the table. In this manner, queries against the table can also include criteria against the contents of the external files.

Omnidex allows this by using an Expression-based Column. An expression-based column is a virtual column declared in the table that does not exist in the underlying relational table or raw data file. Instead, the column is fulfilled by a SQL expression each time a row is read. Omnidex provides a $RETRIEVE_FILE SQL function that can be used in an expression-based column.

The $RETRIEVE_FILE function references a column in the table that contains the filename. When the function is processed for each row, the respective file is opened and the contents are deposited into the expression-based column. The expression-based column can then be indexed and queried as needed.

Sample Database

To demonstrate the $RETRIEVE_FILE function, and to provide examples for this section, we will use the following BOOKS table, which catalogs popular books.

create environment             
 in                            "books.xml"
 with                          delete;

create database                "TEXT"
 type                          file
 index_directory               "idx"
 in                            "books.xml";

create table                   "BOOKS"
 options                       "delimited"
 physical                      "dat/books.txt"
  "DOC_ID"                           character(8)   omnidex,
  "CLASS"                            character(4)   omnidex,
  "FICTION"                          character(1)   omnidex,
  "LANGUAGE"                         character(32)  omnidex,
  "TITLE"                            string(80)     fulltext,
  "AUTHOR"                           string(80)     fulltext   usage "NAME",
  "SOURCE"                           string(80)     quicktext,
  "FILENAME"                         string(255)    quicktext,
  "CONTENT"                          string(1MB)    fulltext   usage "TEXT"
   as "$retrieve_file(FILENAME, 'STRING(1MB)')",
  constraint DOC_ID_PK primary ("DOC_ID"),
 in                            "books.xml";

Additional Resources

See also:

Back to top
admin/indexing/text/retrieve.txt ยท Last modified: 2016/06/28 22:38 (external edit)