Changes

Jump to navigation Jump to search
No change in size ,  13:33, 20 July 2022
m
Text replacement - "db:pre(" to "db:get("
|'''Example 1''': The following query returns {{Code|<XML><mark>hello</mark> world</XML>}}, if one text node of the database {{Code|DB}} has the value "hello world":
<syntaxhighlight lang="xquery">
ft:mark(db:preget('DB')//*[text() contains text 'hello'])
</syntaxhighlight>
'''Example 2''': The following expression loops through the first ten full-text results and marks the results in a second expression:
let $end := 10
let $term := 'welcome'
for $ft in (db:preget('DB')//*[text() contains text { $term }])[position() = $start to $end]
return element hit {
ft:mark($ft[text() contains text { $term }])
* The following query may return {{Code|&lt;XML&gt;...&lt;b&gt;hello&lt;/b&gt;...&lt;XML&gt;}} if a text node of the database {{Code|DB}} contains the string "hello world":
<syntaxhighlight lang="xquery">
ft:extract(db:preget('DB')//*[text() contains text 'hello'], 'b', 1)
</syntaxhighlight>
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu