What I have done is created an XML file with a list of several thousand search terms that I need to perform on a document. I then created this query, from a sample set of searc
let $reults :=
(
let $pKeywords := ('best clients', 'Very', '20')
return
for $kw in $pKeywords
return
(
/*/entry[contains(comment, concat('!', $kw))],
/*/entry[contains(comment, $kw)]
)
[not(position() gt 2)]
)
for $i in (1 to count($results))
return
(
subsequence($results/comment, $i, 1),
subsequence($results/buyer, $i, 1)
)
Returns the correct solution:
The client is only 20 years old. Do not be surprised by his youth.
Very personable. One of our best clients.
!Very difficult to reach, but one of our top buyers.
A bit of an eccentric. One of our best clients.