TSWORD()

From Recital Documentation Wiki
Jump to: navigation, search

Purpose

Function to extract a word from a text string or create the key for a Text Search Index


Syntax

TSWORD(<expC>,<expN>)


See Also

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


Description

The TSWORD() function is used to extract a word from a text string or to create the key for a Text Search Index. The <expC> is the character string from which to extract the word or on which the index key is built. The <expN> is the number of the word to be extracted or indexed, starting from 1. Words are defined as a series of characters separated by one or more spaces.

Memo fields can be included in Text Search Indexe keys by using the MTOS() memo-to-string conversion function.

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

? tsword("Hello World",1)
Hello
 
use example
index on tsword(street,1) to streetsearch
nRecno = tspos("Road",1)
if nRecno > 0
do while nRecno > 0
? "Record found.  Record #",nRecno
?
nRecno =  tspos("Road",0)
enddo
endif
 
use example
index on tsword(first_name+last_name,1) to namesearch
? tspos("Siegel",0)
         1
? tspos("Al Siegel",0)
         1
 
use example
index on tsword(mtos(notes),1) to memosearch


Products

Recital, Recital Server