near (proximity operator)

The near operator retrieves documents that contain two specified words appearing in any order, providing that the words are within a specified distance from each other.

The near operator is the specified with the <near> element. The VALUE attribute lets you specify the maximum distance, in number of words, between the search words.

This sample query retrieves documents that contain the words children and toys if the words appear in any order, and if the two words are separated by at most 5 words. A document containing the sentence "Children need good toys" would be retrieved. A document containing "Children need good hugs and good toys" would not be retrieved, since the search words are too far apart.

The near operator differs from the adj operator in that the words need not appear in any particular order.
<?xml version="1.0" encoding="UTF-16"?>
<!-- nearQuery.xml -->
<query VERSION="4.5" RESULTSPACE="nearQuery">
    <key NAME="FullText">
        <near VALUE="5">
            <elem>children</elem>
            <elem>toys</elem>
        </near>
    </key>
</query>