Home

Getting Started

Utilities

Indexing

Omnidex

Development

Tutorials

Quick Links

 

Tutorials

Omnidex Text

1 - Open and Change the File

2 - Compile oaglobal

3 - Reinstall & Rebuild the Indexes

4 - Load the ofx File

5 - Test the List

 

Synonym Searches

Omnidex Text

 

Tutorials

 

Modify an Existing Synonym List

In this lesson, we will modify an existing managed synonym list, recompile the oaglobal environment to make it accessible to Omnidex applications, and test it with ODXSQL.

We are going to modify the STATE_CODES synonym list to include a few state "mottos". This will allow a user to enter a motto and find the corresponding state. While this is not a very practical example, it is sufficient to demonstrate how to modify a synonym list.

If modifying a synonym list provided with the Omnidex software, it is advisable to keep a separate copy in a secure separate location. When reinstalling or upgrading Omnidex software, the contents of the default directories, including all the synonym lists, will be deleted and replaced with newer versions of the software.

 

Step 1 - Locate and Open the File Containing the Synonym List

Synonym lists are stored in the OMNIDEX_HOME/config/english/synonyms directory. Many of the files in this directory contain multiple lists, although the list we are going to modify for this lesson contains only one list. The file is states.txt.

Open this file and locate the entry for CO. Change this entry to include the phrases "Colorful Colorado" and "Centennial State", and add a new entry, as follows:

STATE_CODES

CO

CO, Colorado, "Colorful Colorado", "Centennial State"

STATE_CODES

Colorful Colorado

>CO

STATE_CODES

Centennial State

>CO

Be sure to separate each column with a tab.
You can add more for the other states, but it is not necessary for this example.

Save the changed file.

 

Step 2 - Recompile oaglobal

Recompile the Omnidex global environment file (oaglobal). oaglobal.src is the environment source file and is located in OMNIDEX_HOME/config, along with the compiled environment file (oaglobal.env), an index installation script (oaglobalin), and a use file to load the offset indexes (oagloballd).

It is not necessary and not recommended that any manual changes be made to any of these files.
From the command prompt, move to the config directory. Run OACOMP to compile oaglobal.

> oacomp oaglobal

 A message will be displayed indicating the success or failure of the operation. If it fails, contact DISC Technical Support. Otherwise, continue with step 3.

 

Step 3 - Reinstall and Rebuild the Indexes for oaglobal

Reinstall and rebuild the indexes on the Omnidex global environment file. The installation script is located in the directory indicated in step 2.
From the same command prompt, run DBINSTAL using the installation script.

> dbinstal < oaglobalin

This may take a few seconds to complete. If it fails, contact DISC Technical Support. Otherwise, continue with step 4.

 

Step 4 - Load the OFX

Reload the offset index files by executing the use file (oagloballd) in ODXSQL. This is required whenever using TDF data files. The use file is located in the directory indicated in step 2.
From the command prompt, run ODXSQL with the -use directive, passing in oagloballd.

> odxsql -use=oagloballd

This may take a few seconds to complete. If it fails, contact DISC Technical Support. Otherwise, you are ready to test it out.
Exit ODXSQL then continue to step 5.

> exit

 

Step 5 - Test the Installation

Test the installation. For this example, we're going to use ODXSQL to make sure the synonym list is accessible and returning correct results.

 

First, change directories to the Omnidex installation of your choice. Make sure it has a column containing relevant data, states. This column must be installed with an MDK index. In this example, we will use the Order sample database.

Run ODXSQL and connect to that environment.

odxsql orders
Connected to C:\DOCSAMPLES\orders\ssv\orders.env

>

Execute a select statement similar to the following:

select city, state from customers where $contains(state,'centennial state','synonyms=state_codes')

The relevant parts of this statement are the $contains criteria predicate where the synonyms=state_codes option is passed, and the keyword centennial state.

 

The second way to test the synonym list is to select the synonyms from the synonym list without touching the data. This is accomplished by selecting $lookup from the $omnidex table while connected to any Omnidex environment, as shown.

Set the display to show multiple lines so the entire result is displayed.

> set multiline on

Execute a select statement similar to the following:

select $lookup(customers.state, 'colorful colorado', 'synonyms=state_codes') from $omnidex

$lookup has the same signature as $contains, except $lookup does not support a label (optional in $contains). A table qualified column is required, although it can be any column, since it will only be used for the output. The value returned is the altered criteria predicate that would be used if a $contains criteria predicate were used.

 


The third way to test the synonym list is to use the explain plan to show exactly how the statement will be processed as well as the how the criteria is changed with the synonym list.

Turn on the explain plan for the Omnidex Text feature. This is done with the set option explain text.

> set explain text

Execute a select statement preceded by the explain command:

> explain select city, state from customers where $contains(state,'centennial state','synonyms=state_codes')

Omnidex executes the select statement but returns a formatted explain plan instead of the selected rows.

If the installation was successful and the tests worked, your custom synonym list is available to all local Omnidex installations.

 

Top