A RESTful browser for eXist Java-Based Function Modules


http://exist-db.org/xquery/ngram
A module for NGram-based indexed searching.

ngram:contains($nodes as node()*, $queryString as xs:string?) node()*
Similar to the standard XQuery fn:contains function, but based on the NGram index. Searches the given $queryString in the index defined on the input node set $nodes. The string may appear at any position within the node content. String comparison is case insensitive. Nodes need to have an ngram index to be searched.
$nodesThe input node set to search
$queryStringThe exact string to search for

Returns a set of nodes from the input node set $nodes containing the query string or the empty sequence

ngram:ends-with($nodes as node()*, $queryString as xs:string?) node()*
Similar to the standard XQuery fn:ends-with function, but based on the NGram index. Searches the given $queryString in the index defined on the input node set $nodes. The string has to appear at the end of the node's content. String comparison is case insensitive. Nodes need to have an ngram index to be searched.
$nodesThe input node set to search
$queryStringThe exact string to search for

Returns a set of nodes from the input node set $nodes ending with the query string or the empty sequence

ngram:filter-matches($nodes as node()*, $function-reference as function) node()*
Highlight matching strings within text nodes that resulted from a ngram search. The function takes a sequence of nodes as first argument $nodes and a callback function (defined with util:function) as second parameter $function-reference. Each node in $nodes will be copied into a new document fragment. For each ngram match found while copying a node, the callback function in $function-reference will be called once. The callback function should take 2 arguments:
1) the matching text string as xs:string,
2) the node to which this text string belongs.
The callback function should return zero or more nodes, which will be inserted into the resulting node set at the place where the matching text sequence occurred.
Note: a ngram match on mixed content may span multiple nodes. In this case, the callback function is called once for every text node which is part of the matching text sequence.
$nodesThe sequence of nodes
$function-referenceThe callback function

Returns a resulting node set

ngram:starts-with($nodes as node()*, $queryString as xs:string?) node()*
Similar to the standard XQuery fn:starts-with function, but based on the NGram index. Searches the given $queryString in the index defined on the input node set $nodes. The string may appear at any position within the node content. String comparison is case insensitive. Nodes need to have an ngram index to be searched.
$nodesThe input node set to search
$queryStringThe exact string to search for

Returns a set of nodes from the input node set $nodes starting with the query string or the empty sequence
Return to list of all modules