Home

Getting Started

Utilities

Indexing

Omnidex

Development

Tutorials

Quick Links

 

Tutorials

Omnidex Text

1 - Create the File

2 - Create the List

3 - Move the File

4 - Compile oaglobal

5 - Reinstall & Rebuild the indexes

6 - Load the ofx File

7 - Test the List

 

Synonym Searches

Omnidex Text

 

Tutorials

 

Adding a Custom Synonym List

In this lesson, we will create a new managed synonym list in its own file, add it to the oaglobal environment to make it accessible to Omnidex applications, and test it with ODXSQL.

The custom synonym list will be 10 basic colors associated with 75 varying shades.

 

Step 1 - Create the Empty File

Create a new empty text file using your favorite text editor and save it as colors.txt.
Or open a new empty spreadsheet in Microsoft Excel, click File/Save As in the menu, choose Text (Tab delimited) (*.txt) from the "Save as type" drop down list, change the name to colors.txt and click Save.

 

Step 2 - Create the Synonym List

Enter the following data, or cut and paste to save some typing, into the new file. If using a text editor, be sure that there is a single tab between each column, and a new line between each row.

In this example, COLOR_MATCH, in the first column, is the unique synonym list name.

The second column is the basic color. This is the keyword that will be passed to Omnidex in the query criteria.

The last column is the list of synonyms for the keyword in column 2. When the keyword "YELLOW", for example, is passed in the query criteria, the criteria will be expanded to include all of the synonyms for YELLOW.

The criteria will change from
color='YELLOW'
to
color in ('YELLOW', 'GOLD', 'GOLDENROD', 'DAISY', 'DANDELION', 'CANARY', 'AMBER', 'STRAW', 'LEMON', 'BUTTERCUP').

If using a text editor, cutting and pasting this text might cause each column of every row to appear on its own line. Be sure to fix any improper formatting before continuing.

COLOR_MATCH

YELLOW

YELLOW, GOLD, GOLDENROD, DAISY, DANDELION, CANARY, AMBER, STRAW, LEMON, BUTTERCUP

COLOR_MATCH

ORANGE

ORANGE, APRICOT, PEACH, MELON, TANJERINE, SALMON, "BURNT ORANGE"

COLOR_MATCH

RED

RED, BITTERSWEET, MAHOGANY, MAROON, RUBY, ROSE, BLUSH, PINK, CRIMSON, MAGENTA, CORAL, TOMATO, SALMON, FUCHSIA, "BRICK RED", "HOT PINK"

COLOR_MATCH

PURPLE

PURPLE, LAVENDAR, LILAC, VIOLET, PLUM, MULBERRY, PERIWINKLE, THISTLE, ORCHID, FUCHSIA

COLOR_MATCH

BLUE

BLUE, NAVY, CYAN, PERIWINKLE, CORNFLOWER, MIDNIGHT, ROYAL, CERULEAN, AQUA, TEAL, INDIGO, AZURE, TURQUOISE, "SKY BLUE", "STEEL BLUE", "SLATE BLUE", "POWDER BLUE"

COLOR_MATCH

GREEN

GREEN, EMERALD, LIME, OLIVE, GRASS, PINE, SPRING, FOREST, AQUAMARINE, TEAL, TURGUOISE, MINT, CHARTREUSE, "NEON GREEN", "SEA GREEN"

COLOR_MATCH

BROWN

BROWN, TAN, SEPIA, SIENNA, TAN, TAUPE, CHOCOLATE, COFFEE, CAMEL, SANDY, BEIGE, KHAKI, WHEAT, ALMOND

COLOR_MATCH

BLACK

BLACK, CHARCOAL, "DARK GRAY"

COLOR_MATCH

GRAY

GRAY, GREY, CHARCOAL, SILVER, PEWTER, METALLIC, CHROME, SMOKE, "LIGHT GRAY", "DARK GRAY", "SLATE GRAY"

COLOR_MATCH

WHITE

WHITE, SNOW, SEASHELL, LINEN, SMOKE, IVORY, ALMOND, "OFF WHITE", "EGG SHELL", "ANTIQUE WHITE"

 

Step 3 - Move the File

Move colors.txt to the synonyms directory to make it accessible to oaglobal. This directory is located in OMNIDEX_HOME/config/english/synonyms. Notice that this directory already contains several other files. These files are the managed synonym lists provided with the Omnidex software and the offset index file (ofx) that Omnidex uses in searches against these lists.

It may be a good idea to keep a copy of the custom synonym list in a separate location, just in case.

 

Step 4 - 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 5.

 

Step 5 - 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 4.
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 6.

 

Step 6 - 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 4.
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 7.

> exit

 

Step 7 - 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. There are a three easy ways to test this in ODXSQL.

 

First, change directories to the Omnidex installation of your choice. Make sure it has a column containing relevant data, specifically colors that are found in the synonym lists. This column must be installed with an MDK index.

Run ODXSQL and connect to that environment.

> odxsql omniproducts
Connected to C:\DOCSAMPLES\omniprod\omniproducts.env

>

Execute a select statement similar to the following:

select productname from products where $contains(productname,'green','synonyms=color_match')

The relevant part of this statement is the $contains criteria predicate where the synonyms=color_match option is passed.

 

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.

> odxsql omniproducts
Connected to C:\DOCSAMPLES\omniprod\omniproducts.env

>

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(products.productname, 'red', 'synonyms=color_match') 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.

Notice that quoted phrases in the synonym list are displayed as two words "ANDED" together, as in HOT AND PINK.

 


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.

> odxsql omniproducts
Connected to C:\DOCSAMPLES\omniprod\omniproducts.env

>

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 productname from products where $contains(productname, 'purple', 'synonyms=color_match')

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