Tamino XML Server Version 9.7
 —  XQuery 4 Reference Guide  —

ft:proximity-contains

Search for word tokens within some distance.


Syntax

ft:proximity-contains(node $node, string $searchString, integer $distance, boolean $ordered) => boolean

Top of page

Description

This text retrieval function searches a node for a sequence of one or more word tokens (passed as a string) within a specified proximity distance and in a specified order. If the argument $node evaluates to the empty sequence, false is returned.

The $distance argument determines how far apart the matched word tokens in the string value of the node may be. The distance is evaluated as the maximum number of unmatched tokens between the first matched word token and the last matched word token in $searchString. The function returns true, if $distance is larger than this computed distance. For example, a value of "1" means they must follow immediately after one another, a value of 2 allows a gap of one word in between etc.

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

There are no defaults defined, so you need to invoke it with all arguments. 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 one of the functions tf:containsText, tf:containsAdjacentText or tf:containsNearText instead. See the examples for details.

Top of page

Arguments

$node

node to be searched

$searchString

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

$distance

integer value denoting proximity distance

$ordered

if true, the order of word tokens in $searchString is taken into account.

Top of page

Examples

In the patient sample data, there is a remarks element for the patient Bloggs that reads: "Patient is responding to treatment. Dr. Shamir.".

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:

Top of page