Changes

Jump to navigation Jump to search
111 bytes removed ,  16:18, 23 April 2011
no edit summary
|-
| valign='top' width='90' | '''Signatures'''
|<code><b>ft:search</b>($node as node(), $text as xs:string) as text()</code><br />
|-
| valign='top' | '''Summary'''
|Performs a full-text index request on the specified database node and returns all text nodes that contain the string <code>$text</code>. The index full-text options are used for searching, i.e., if the index terms were stemmed, the search string will be stemmed as well.|-| valign='top' | '''Errors'''|<b>[[XQuery Errors#BaseX Errors (BASX)|BASX0002]]<br /b>is raised if the context item does not represent a database node.
|-
| valign='top' | '''Examples'''
|The expression * <code>ft:search(., "QUERY")</code> returns all text nodes of the currently opened database that contain the string "QUERY".<br />|-| valign='top' | '''Errors'''|<b>[[XQuery Errors#BaseX Errors (BASX)|BASX0002]]</b> is raised if the context item does not represent a database node.<br />
|}
|-
| valign='top' width='90' | '''Signatures'''
|<code><b>ft:mark</b>($nodes as node()*) as node()*</code><br /><code><b>ft:mark</b>($nodes as node()*, $tag as xs:string) as node()*</code><br />
|-
| valign='top' | '''Summary'''
|Puts a marker element around the resulting <code>$nodes</code> of a full-text index request.<br />The default tag name of the marker element is <code>mark</code>. An alternative tag name can be chosen via the optional <code>$tag</code> argument.<br />Note that the XML node to be transformed must be an internal "database" node. The <code>transform</code> expression can be used to apply the method to a main-memory fragment (see example).|-| valign='top' | '''Errors'''|<b>[[XQuery Errors#BaseX Errors (BASX)|BASX0002]]</b> is raised if the context item does not represent a database node.<br /><b>[[XQuery Errors#Functions Errors (FOAR, FOCA, FOCH, FODC, FODF, FODT, FOER, FOFD, FONS, FORG, FORX)|FOCA0002]]</b> is raised if <code>$name</code> is no valid QName.
|-
| valign='top' | '''Examples'''
|* The following query returns <code>&lt;XML&gt;&lt;mark&gt;hello&lt;/mark&gt; world&lt;/XML&gt;</code>, if one text node of the database <code>DB</code> has the value "hello world":<br /pre class="brush:xquery"><code>ft:mark(db:open('DB')//*[text() contains text 'hello'])</code><br /pre>* The following expression returns <code>&lt;p&gt;&lt;b&gt;word&lt;/b&gt;&lt;/p&gt;</code>:<br /pre class="brush:xquery"><code>copy $p := &lt;p&gt;word&lt;/p&gt;</code><br /><code>modify ()</code><br /><code>return ft:mark($p[text() contains text 'word'], 'b')</code><br />|-| valign='top' | '''Errors'''|<b>[[XQuery Errors#BaseX Errors (BASX)|BASX0002]]</b> is raised if the context item does not represent a database node.<br /><b>[[XQuery Errors#Functions Errors (FOAR, FOCA, FOCH, FODC, FODF, FODT, FOER, FOFD, FONS, FORG, FORX)|FOCA0002]]</b> is raised if <code>$name</code> is no valid QName.<br /pre>
|}
|-
| valign='top' width='90' | '''Signatures'''
|<code><b>ft:extract</b>($nodes as node()*) as node()*</code><br /><code><b>ft:extract</b>($nodes as node()*, $tag as xs:string) as node()*</code><br /><code><b>ft:extract</b>($nodes as node()*, $tag as xs:string, $length as xs:integer) as node()*</code><br />
|-
| valign='top' | '''Summary'''
|Extracts and returns relevant parts of full-text results. It puts a marker element around the resulting <code>$nodes</code> of a full-text index request and chops irrelevant sections of the result.<br />The default tag name of the marker element is <code>mark</code>. An alternative tag name can be chosen via the optional <code>$tag</code> argument.<br />The default length of the returned text is <code>150</code> characters. An alternative length can be specified via the optional <code>$length</code> argument. Note that the effective text length may differ from the specified text due to formatting and readibility issues.|-| valign='top' | '''Errors'''|<b>[[XQuery Errors#BaseX Errors (BASX)|BASX0002]]</b> is raised if the context item does not represent a database node.<br /><b>[[XQuery Errors#Functions Errors (FOAR, FOCA, FOCH, FODC, FODF, FODT, FOER, FOFD, FONS, FORG, FORX)|FOCA0002]]</b> is raised if <code>$name</code> is no valid QName.
|-
| valign='top' | '''Examples'''
|* The following query may return <code>&lt;XML&gt;...&lt;b&gt;hello&lt;/b&gt;...&lt;XML&gt;</code> if a text node of the database <code>DB</code> contains the string "hello world":<br /pre class="brush:xquery"><code>ft:extract(db:open('DB')//*[text() contains text 'hello'], 'b', 1)</code><br />|-| valign='top' | '''Errors'''|<b>[[XQuery Errors#BaseX Errors (BASX)|BASX0002]]</b> is raised if the context item does not represent a database node.<br /><b>[[XQuery Errors#Functions Errors (FOAR, FOCA, FOCH, FODC, FODF, FODT, FOER, FOFD, FONS, FORG, FORX)|FOCA0002]]</b> is raised if <code>$name</code> is no valid QName.<br /pre>
|}
|-
| valign='top' width='90' | '''Signatures'''
|<code><b>ft:score</b>($item as item()*) as xs:double*</code><br />
|-
| valign='top' | '''Summary'''
|Returns the score values (0.0 - 1.0) that have been attached to the specified items. <code>0</code> is returned a value if no score was attached.<br />
|-
| valign='top' | '''Examples'''
|The expression * <code>ft:score('a' contains text 'a')</code> returns the <code>xs:double</code> value <code>1</code>.<br />
|}
[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu