Name
text_contains — Returns true if the text value of some node in the given node-set contains the text matching the given free-text query, otherwise returns false.
Synopsis
boolean
text_contains
(
|
scope node-set , |
query
string
) ; |
Description
This function calculates text values of nodes from the
scope
, and checks whether the current text value
contains any fragment that matches the query
.
When the first match is found, the rest of the node-set is ignored the
boolean 'true' is returned. If the node-set ends before any match is
found, 'false' is returned.
The text_contains()
function may be used only
in XPath expressions that are arguments of xcontains()
.
This restriction is for optimization purposes. When Virtuoso executes an
SQL statement that uses xcontains()
, it performs some
sophisticated free-text search, and it applies the XPath expression not to
all available documents but only to documents that satisfied the free-text
search criterion. Moreover, the server uses the intermediate free-text
data to optimize the search inside a selected document.
Parameters
scope
The node-set where the text search is performed.
query
The text of the query.
Return Types
Returns a boolean: True or False.
When the first match is found, the rest of the node-set is ignored the boolean 'true' is returned. If the node-set ends before any match is found, 'false' is returned.
Errors
Table 24.151. Errors signalled by text-contains()
SQLState | Error Code | Error Text | Description |
---|---|---|---|
XP370 | XPF11 | XPATH function text-contains() is allowed only in special SQL predicate xcontains() | The XPath processor is called not by xcontains() but by some other way so it has no suitable free-text data. |
XP001 | XPF13 | Unsupported combination of arguments in XPATH function text-contains() | The XPath processor has failed to built an execution plan for the free-text search. |
Examples
Example 24.632.