This is an old revision of the document!


Administration: Omnidex Indexing

Omnidex Text

Displaying Results

Proximity searches can qualify rows with large blocks of text using Phrase Searches, BEFORE Searches and NEAR Searches. Once the rows are qualified, the obvious next step is to display the results. This can be more difficult if the text is as long as an entire book, or some other large block of text.

Omnidex allows excerpts to be retrieved from large blocks of text to make viewing easier. These excerpts show the portions of the text that qualified the row, with the search terms highlighted.

Excerpts are retrieved using the $CONTEXT function. The $CONTEXT function works hand-in-hand with the $CONTAINS function. The $CONTAINS function is used to label a particular proximity search, and the $CONTEXT function retrieves excerpts for that same label. This is needed before there may be other criteria in the SQL statement, and even multiple Proximity Searches against multiple columns and tables. Only one Proximity Search can feed these excerpts, necessitating the pairing of the $CONTAINS function and the $CONTEXT function.

$CONTAINS Function

The $CONTAINS function allows a specific WHERE clause predicate to be labelled, and also allows options that control the search. In its simplest form, the following two statements are identical:

> select title from books where language = 'English';

TITLE
-----------------------------------------------------------------------------
Alice's Adventures in Wonderland
Around the World in Eighty Days
Hamlet
The Adventures of Tom Sawyer
The Wonderful Wizard of Oz
5 rows returned
>
> select title from books where $contains(language, 'English');

TITLE
-----------------------------------------------------------------------------
Alice's Adventures in Wonderland
Around the World in Eighty Days
Hamlet
The Adventures of Tom Sawyer
The Wonderful Wizard of Oz
5 rows returned
>

The $CONTAINS function also allows options that manually engage the PowerSearch features, such as misspellings, synonyms, etc.

> select title from books where $contains(content, 'missisipi','misspellings');

TITLE
-----------------------------------------------------------------------------
Around the World in Eighty Days
The Adventures of Tom Sawyer
2 rows returned

The $CONTAINS function allows criteria to be labelled for eventual pairing with excerpts using the $CONTEXT function or relevancy scoring using the $SCORE function:

> select        TITLE
>>  from        BOOKS
>>  where       $contains(LANGUAGE, 'English',, 'LANGUAGE') and
>>              $contains(CONTENT, 'missisipi', 'misspellings', 'CONTENT');

TITLE
-----------------------------------------------------------------------------
Around the World in Eighty Days
The Adventures of Tom Sawyer
2 rows returned

$CONTEXT Function

The $CONTEXT function retrieves excerpts of a text field based on a paired $CONTAINS function. By default, a simple excerpt is displayed; however, options exist to allow embedding HTML tags to highlight the search terms for easy display in a web environment.

> select        TITLE,
>>              $context
>>  from        BOOKS
>>  where       $contains(CONTENT, 'missisipi', 'misspellings');
TITLE
-----------------------------------------------------------------------------
$CONTEXT(BOOKS.CONTENT)
-----------------------------------------------------------------------------
Around the World in Eighty Days
--- at Nauvoo, on the *Mississippi*, numbering twenty-five thousand ---
>> night it crossed the *Mississippi* at Davenport, and by ---

The Adventures of Tom Sawyer
--- a point where the *Mississippi* River was a trifle --- and saw the broad
>> *Mississippi* rolling by! ---
2 rows returned
<edit/code>

Excerpts can be easily formatted for display using HTML, including assigning CSS classes as needed:

<code>
> select        TITLE,
>>              $context(255, 'STYLE=HTML CLASSES')
>>  from        BOOKS
>>  where       $contains(CONTENT, 'missisipi', 'misspellings');
TITLE
-----------------------------------------------------------------------------
$CONTEXT(BOOKS.CONTENT)
-----------------------------------------------------------------------------
Around the World in Eighty Days
--- at Nauvoo, on the <span class="odx_word">Mississippi</span>, numbering
>> twenty-five thousand --- night it crossed the <span
>> class="odx_word">Mississippi</span> at Davenport, and by ---
The Adventures of Tom Sawyer
--- a point where the <span class="odx_word">Mississippi</span> River was a
>> trifle --- and saw the broad <span class="odx_word">Mississippi</span>
>> rolling by! ---
2 rows returned

Additional Resources

See also:

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