Changes

Jump to navigation Jump to search
120 bytes removed ,  18:30, 1 December 2023
m
Text replacement - "</syntaxhighlight>" to "</pre>"
}
})
</syntaxhighlightpre>
* Iterate over three databases and return all elements containing terms similar to {{Code|Hello World}} in the text nodes:
<syntaxhighlight lang="xquery">
let $dbname := 'DB' || $db
return ft:search($dbname, $terms, map { 'fuzzy': $fuzzy })/..
</syntaxhighlightpre>
|}
let $term := ft:tokenize($term)
return number(ft:tokens('db', $term)[. = $term]/@count)
</syntaxhighlightpre>
|}
<syntaxhighlight lang="xquery">
ft:contains("John Doe", ("jack", "john"), map { "mode": "any" })
</syntaxhighlightpre>
* Calls the function with stemming turned on and off:
<syntaxhighlight lang="xquery">
(true(), false()) ! ft:contains("Häuser", "Haus", map { 'stemming': ., 'language':'de' })
</syntaxhighlightpre>
|}
'happy'
)
</syntaxhighlightpre>
|}
<syntaxhighlight lang="xquery">
ft:mark(db:get('DB')//*[text() contains text 'hello'])
</syntaxhighlightpre>
'''Example 2''': The following expression loops through the first ten full-text results and marks the results in a second expression:
<syntaxhighlight lang="xquery">
for $ft in (db:get('DB')//*[$test(.)])[position() = $start to $end]
return ft:mark($ft[$test(.)])
</syntaxhighlightpre>
'''Example 3''': The following expression returns <code>&lt;xml>hello &lt;b&gt;word&lt;/b&gt;&lt;/xml&gt;</code>:
<syntaxhighlight lang="xquery">
modify ()
return ft:mark($p[text() contains text 'word'], 'b')
</syntaxhighlightpre>
|}
<syntaxhighlight lang="xquery">
ft:extract(db:get('DB')//*[text() contains text 'hello'], 'b', 1)
</syntaxhighlightpre>
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu