# 22. Virtuoso Functions Guide - text_contains()

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
and
append
assign
avg
boolean
ceiling
concat
contains
count
create-attribute
create-comment
create-element
create-pi
current
distinct
doc
document
document-literal
empty
ends-with
every
except
false
filter
floor
fn:collection
for
format-number
function-available
generate-id
id
if
intersect
is_after()
is_before()
key
lang
last
let
list()
local-name
max
min
name
namespace-uri
normalize-space
not
number
or
position
processxquery
processxslt
processxsql
progn()
replace()
round
serialize
shallow
some
starts-with
string
string-length
substring
substring-after
substring-before
sum
system-property
text_contains()
translate
true
tuple()
union
unordered
unparsed-entity-uri
urlify
xmlview
Functions Index

## 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.
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

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

See Also

xcontains predicate