TSPOS()

From Recital Documentation Wiki
Revision as of 14:58, 20 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

TSPOS()

Class

Text Searching


Purpose

Function to search a Text Search Index for one or more words


Syntax

TSPOS(<expC>,<expN>)


See Also

INDEX, KEY(), LOWER(), NDX(), TSWORD(), UPPER(), SET INDEX, SET ORDER, SET TSLENGTH, DB_TSINDEX


Description

The TSPOS() function is used to search the currently active Text Search Index. If the search is successful, the record pointer is positioned to the matching record and the record number is returned. If no matching record is found, the TSPOS() function returns -1.

The <expC> is the word list for which to search. Words should be space-separated. The <expN> is the occurrence number for which to search. If <expN> is 0, the index is searched for the first match to a new search or the next match based on a previous search.

The UPPER() or LOWER() functions can be used when creating indexes and when conducting index searches to make them case-insensitive.

The DB_TSINDEX environment variable / symbol must be set to "ON" when building or using Text Search Indexes.


Example

use example
index on tsword(first_name+last_name,1) to namesearch
? tspos("John",0)
        42
? tspos("John",0)
        43
? tspos("John",0)
        -1
? tspos("John",1)
        42


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer