There is one API function for searching for text: the DesGetSearchResultTable function.
The DesGetSearchResultTable function receives a search argument for searching through text documents in a particular text column, and stores the result in a table. The result table contains the handle of each document found. It can also contain rank information and the number of matches, depending on the search option specified.
You can also obtain this information using the RANK and NO_OF_MATCHES UDFs. Here is an example:
INSERT INTO RESULT SELECT COMMENTHANDLE, RANK(COMMENTHANDLE, '"stored procedures"'), NO_OF_MATCHES(COMMENTHANDLE, '"stored procedures"') FROM DB2TX.SAMPLE WHERE CONTAINS(COMMENTHANDLE, '"stored procedures"') = 1
DesGetSearchResultTable can be used only on base tables, but it can be faster than using UDFs if the query is a text-only query; it goes directly to the Text Extender server to get the rank and the number of matches, and it loops only for the number of matching documents found. In the UDF example, on the other hand, the CONTAINS function is called once for each row in the table; then, for each qualifying row, the RANK and NO_OF_MATCHES functions are called. For each found document, three separate searches are made.
The input parameters are:
If a browse option is specified, this function returns a pointer to browse information.