$LOOKUP
The $LOOKUP function is a select-list item only function that is used
to retrieve textual metadata. Similarly, the ODXSQL utility provides a
LOOKUP command to retrieve the same information.
Many textual applications have flexible and intuitive user interfaces
that assist users in assembling queries. A common example is an application
that checks criteria for spelling errors. Alternatively, if a query does
not return any results, the application may suggest alternate criteria
that appear somewhat similar but may produce better results.
These applications require an ability to retrieve textual metadata, which
refers to items such as definitions for a word or phrase, suggestions
for alternate words or phrases, or expanded searches like synonyms, misspellings
or word forms. The $LOOKUP function provides the ability to retrieve this
textual metadata, quickly and easily.
The $LOOKUP function can only be used as a select item in a SQL SELECT
statement, and is usually used against the $OMNIDEX table, a fictitious
table that always returns exactly one row.
The $LOOKUP function returns a buffer of data type C STRING using the
default length, or the length specified in the length parameter.
Syntax
$LOOKUP(word [, length[, options]])
word
Required. The word(s) to be used in the search.
length
Required. The length of the string to be returned. Default, 4096.
options
Optional. See Options (below) for a list of valid
options. Multiple options are processed in the order listed in the options
parameter.
Options
SYNONYMS[=list]
Retrieve the synonyms of each word, using the named list, if specified.
SPELLCHECK[=list]
Check each word to see if it is a commonly misspelled word, and automatically
replace the word with the correct spelling. If list is not provided, then
use the list declared in the environment file for this column. If no list
is provided in the environment file, then use the default list provided
with Omnidex (recommended).
MISSPELLINGS[=list]
Retrieve the possible misspellings for this word or phrase, using the
named list, if specified. To check misspellings against the content of
a column, use table.column as the list.
FORMS[=approach]
Retrieve the forms of this word, using the named approach, if specified.
Approach can be set to PLURAL, CONJUGATIONS or DERIVATIONS.
STOPWORDS[=list]
Retrieve whether this word is a stopword, using the named list, if specified.
DEFINITIONS
Retrieve the definitions of this word or phrase.
SUGGESTIONS[=list]
Retrieve the possible suggestions for this word or phrase, using the named
list, if specified. To retrieve the suggestions within the content of
a column, use table.column as the list.
INCLUSIVE
Return the original word in addition to any additional words.
EXCLUSIVE
Return any additional words but exclude the original word.
PARTOFSPEECH=pos
Limit returned words to the named part of speech when searching the thesaurus
or dictionary. pos can be NOUN, VERB, ADJECTIVE, ADVERB.
SENSE=n
Limit returned words to the specified sense when searching the thesaurus
or dictionary.
MAX_SENSES=n | ALL
Limit returned words to the specified number of senses when searching
the thesaurus or dictionary. By default, searches are limited to the most
common sense.
MAX_SUGGESTIONS=n
Limit to n suggestions.
SCORES
Return scores with suggestions.
COUNTS
Return counts with suggestions and validate that suggestions will qualify
rows.
VALIDATE
Validate that suggestions will qualify rows.
The following options control the formatting of the output of the $LOOKUP
function:
STYLE=(TEXT | HTML)
Render the result in TEXT (default) or HTML style.
CLASSES
Return the result preformatted using style sheet classes.
FORMAT=(FORMATTED | COMPRESSED)
Render the result in FORMATTED (default) or COMPRESSED format.
PAGEWIDTH=n
Render the result formatted to n characters wide.
WORD_URL=url
Use url in an HTML href tag for the word with a definition.
POS_URL=url
Use url in an HTML href tag for the part of speech within a definition.
DEF_URL=url
Use url in an HTML href tag for the definition number within a definition.
CATEGORY_URL=url
Use url in an HTML href tag for the category within a definition.
ALT_WORD_URL=url
Use url in an HTML href tag for the alternate word within a definition.
SUGGESTION_URL=url
Use url in an HTML href tag for the suggestion.
Example
>set multiline on
> select $lookup('car',32768,'synonyms') from $omnidex
$LOOKUP()
-----------------------------------------------------------------------------
IN (car) OR IN (auto, automobile, machine, motorcar) OR IN ("motor
vehicle",
>> "automotive vehicle") OR IN (ambulance, "beach
wagon", "station wagon",
>> wagon, "beach waggon", "station waggon",
waggon, bus, jalopy, heap, cab...
1 row returned
> select $lookup('rabbit',,'synonyms') from $omnidex
$LOOKUP()
-----------------------------------------------------------------------------
IN (rabbit) OR IN (coney, cony) OR IN (leporid, "leporid mammal")
OR IN
>> (lapin, bunny, "bunny rabbit", "european rabbit",
"old world rabbit",
>> "oryctolagus cuniculus", "wood rabbit", cottontail,
"cottontail rabbit"...
1 row returned
> select $lookup('walk',,'forms=derivations') from $omnidex
$LOOKUP()
-----------------------------------------------------------------------------
IN (walker,walking,walk)
1 row returned
>
Top
|