ft:text-contains

Search for word tokens in a search string.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

ft:text-contains(node $node, string $searchString) => boolean

Description

This text retrieval function searches a node for a sequence of one or more word tokens (passed as a string). It returns true if all word tokens appear exactly in the order as specified in $searchString.

With ft:text-contains you can perform search operations including the use of a wildcard character. The section Pattern Matching in the XQuery 4 User Guide explains this in detail.

This function is bound to the namespace http://www.w3.org/2002/04/xquery-operators-text and you need to declare that namespace in the query prolog.

Note:
This function is deprecated and will be removed in future versions of Tamino. You should use the function tf:containsText instead. See the examples for details.

Arguments

$node

node in which the search takes place

$searchString

string containing a sequence of one or more words to be searched

Example

  • Retrieve all patients who are responding to current treatment:

    declare namespace ft="http://www.w3.org/2002/04/xquery-operators-text"
    for $a in input()/patient
    where ft:text-contains($a/remarks, "responding to treatment")
    return $a/name

    You can rewrite this query using tf:containsText:

    for $a in input()/patient
    where tf:containsText($a/remarks, "responding to treatment")
    return $a/name