==Positional Filters==
* A popular retrieval operation is to filter texts by the distance of the searched words. In this query… <pre class="brush:xquery"><xml> <text>There is some reason why ...</text> <text>For some good yet unknown reason, ...</text> <text>The reason why some people ...</text></xml>//text[. contains text { "some", "reason" } all ordered distance at most 3 words]</pre> …the two first texts will be returned as result, because there are at most three words between {{Code|some}} and {{Code|reason}}. Additionally, the {{Code|ordered}} keyword ensures that the words are found in the specified order, which is why the third text is excluded. Note that {{Code|all}} is required here to guarantee that only those hits will be accepted that contain all searched words. The {{Code|window}} keyword is related: it accepts those texts in which all keyword occur within the specified number of tokens. Can you guess what is returned by the following query? <pre class="brush:xquery">("A C D", "A B C D E")[. contains text { "A", distance"E" } all window 3 words]</pre> Sometimes it is interesting to only select texts in which all searched terms occur in the {{Code|same sentence}} or {{Code|paragraph}} (you can even filter for {{Code|different}} sentences/paragraphs). By the way, scopethis is not the case in the following example: <pre class="brush:xquery">"I will survive. This is what Mary told me" contains text { "will", "told" } all words same sentence</pre> Three remaining specifiers exist to filter results depending on the position of a hit: * {{Code|at start}} expects tokens to occur at the beginning of a text* {{Code|at end}} expects tokens to occur at the text end* {{Code|entire content}} only accepts texts which have no other words at the beginning or end
==Match Options==