A RESTful browser for eXist Java-Based Function Modules


http://exist-db.org/xquery/text
A module for text searching extension functions.

text:index-terms($nodes as node()*, $qnames as xs:QName+, $start as xs:string?, $function as function, $returnMax as xs:int) item()*
This version of the index-terms function is to be used with indexes that were defined on a specific element or attribute QName. The second argument lists the QNames or elements or attributes for which occurrences should bereturned. Otherwise, the function behaves like the 4-argument version.
$nodesThe set of nodes in which the returned tokens occur
$qnamesOne or more element or attribute names for which index terms are returned
$startThe optional start string
$functionThe callback function reference
$returnMaxThe maximum number of terms to report

Returns the results from the evaluation of the function reference

text:index-terms($nodes as node()*, $start as xs:string?, $function as function, $returnMax as xs:int) item()*
This function can be used to collect some information on the distribution of index terms within a set of nodes. The set of nodes is specified in the first argument $nodes. The function returns term frequencies for all terms in the index found in descendants of the nodes in $nodes. The second argument $start specifies a start string. Only terms starting with the specified character sequence are returned. If $nodes is the empty sequence, all terms in the index will be selected. $function is a function reference, which points to a callback function that will be called for every term occurrence. $returnMax defines the maximum number of terms that should be reported. The function reference for $function can be created with the util:function function. It can be an arbitrary user-defined function, but it should take exactly 2 arguments: 1) the current term as found in the index as xs:string, 2) a sequence containing four int values: a) the overall frequency of the term within the node set, b) the number of distinct documents in the node set the term occurs in, c) the current position of the term in the whole list of terms returned, d) the rank of the current term in the whole list of terms returned.
$nodesThe set of nodes in which the returned tokens occur
$startThe optional start string
$functionThe callback function reference
$returnMaxThe maximum number of terms to report

Returns the results from the evaluation of the function reference
Return to list of all modules