Home

Getting Started

Utilities

Indexing

Omnidex

Development

Tutorials

Quick Links

 

OMNIDEX

Omnidex Text

Options

SYNONYMS Function

Examples

 

$CONTAINS

Managed Synonyms

Thesaurus

 

Omnidex Text

 

Synonym Searches

A Synonym search adds synonyms of the original search criteria keywords, obtained from either from a thesaurus or a managed synonym list, to a query's qualification criteria. Using the provided thesaurus based on the English language, a search for the keyword car would qualify not only rows containing the word car but also rows containing synonyms of car including auto, automobile, the phrase "motor vehicle", and others. And a search for sofa would also find couch, lounge, settee, etc...

Similarly, using the provided managed synonym list "ALL_GIVEN_NAMES", a search for the name Jim would qualify not only rows containing the name Jim but also rows containing James, Jimmy, Jimmie, Jimbo, and others. All of the provided managed synonym lists can be modified and custom managed synonym lists can easily be added. This allows Chevrolet to be defined as a synonym to car and Lazy Boy as a synonym to chair, if the need arises.

Performing a synonym search is almost exactly the same whether using the thesaurus or a managed synonym list. In either case, you use a $CONTAINS criteria predicate with the 'SYNONYMS' option in a SELECT statement, or the SYNONYMS function in a QUALIFY statement. If using a managed synonym list, you must indicate which list to use in the options parameter. If no list is specified, the thesaurus is used by default.

 

 

Options

The following options are for use with a thesaurus synonym search.

LIST = list - Use this named list rather than using the list specified in the list parameter.

PARTOFSPEECH=pos - Limit searches to the named part of speech when using the thesaurus or dictionary. pos can be NOUN, VERB, ADJECTIVE, ADVERB.

SENSE=n - Limit searched to the specified sense when using the thesaurus or dictionary. Senses can be seen by looking up the definition of a word using the $LOOKUP function or using ODXSQL's LOOKUP command.

MAX_SENSES=n | ALL - Limit searches to the specified number of senses when searching the thesaurus or dictionary. By default, searches are limited to the most common sense.

 

SYNONYMS Function

The Synonyms function is provided for use in an Omnidex QUALIFY statement and when QUALIFY syntax is used in a criteria predicate. $CONTAINS should be used otherwise.

Syntax

SYNONYMS(criteria[, list[, options]])

criteria
Required. This is the string criteria to be converted to synonym replacements. Each word or phrase will be replaced with synonym equivalents.

list
Optional. Overrides the list defined in the environment catalog for this column, to use for producing synonyms. 'THESAURUS' instructs Omnidex to the built-in thesaurus to produce synonyms. Otherwise, this may be a named list from the managed synonyms list in the $SYNONYMS table. If omitted, the list defined in the environment catalog will be used. If not defined in the environment catalog, the THESAURUS will be used.

options
Optional. See Options (above) for a list of valid options.

 

 

 

Examples

All of the following statements will produce the same results. All require an MDK index. However, the first four require no additional setup.

SELECT FIRST_NAME FROM CUSTOMERS WHERE $CONTAINS(FIRST_NAME,'fred,'SYNONYMS=ALL_GIVEN_NAMES')

SELECT FIRST_NAME FROM CUSTOMERS WHERE $CONTAINS(FIRST_NAME,'fred,'SYNONYMS','LIST=ALL_GIVEN_NAMES')

QUALIFY CUSTOMERS WHERE FIRST_NAME = 'SYNONYMS(fred,"ALL_GIVEN_NAMES")'

QUALIFY CUSTOMERS WHERE FIRST_NAME = 'SYNONYMS(fred,,"LIST=ALL_GIVEN_NAMES")'

SELECT FIRST_NAME FROM CUSTOMERS WHERE $CONTAINS(FIRST_NAME, '(SYNONYMS(fred,"ALL_GIVEN_NAMES"))')

You can also define the synonyms option in the environment catalog. The following environment catalog column declaration will cause Omnidex to automatically use the "ALL_GIVEN_NAMES" managed synonym list, whenever synonyms are requested in the SQL statement.

COLUMN FIRST_NAME DATATYPE CHAR(20) SYNONYMS 'LIST=ALL_GIVEN_NAMES'
...

SELECT FIRST_NAME FROM CUSTOMERS WHERE $CONTAINS(FIRST_NAME,'fred,'SYNONYMS')

The previous setup requires the application to request synonyms, while the default synonym list is pre-defined.

To cause synonyms to be applied to all queries whether or not they request synonyms, add the AUTOENABLE option to the column declaration.

COLUMN FIRST_NAME DATATYPE CHAR(20) SYNONYMS 'LIST=ALL_GIVEN_NAMES AUTOENABLE'
...

SELECT FIRST_NAME FROM CUSTOMERS WHERE FIRST_NAME='FRED'

 

Top