cts functions (Search)

The search built-in functions are XQuery functions used to perform text searches. The search functions are designed for use with XML structured text. Searches that use these functions use the indexes and are designed to return fast.

There are built-in functions to search through documents (cts:search, cts:contains and cts:highlight); there is a function to tokenize text into different types (cts:tokenize), and there are functions to retrieve result characteristics (for example cts:quality and cts:score). There are also built-in functions to browse word and value lexicons (cts:words, cts:element-values, and so on.) The lexicon built-in functions require the appropriate lexicons to be enabled in the Admin interface.

There are also functions to compose a cts:query, as well as accessor functions to retrieve the parameter values from a cts:query. These functions are documented in the cts:query Constructors section.

16 functions
Function nameDescription
cts:confidence Returns the confidence of a node, or of the context node if no node is provided.
cts:contains Returns true if any of a sequence of nodes matches a query.
cts:deregister Deregister a registered query, explicitly releasing the associated resources.
cts:distinctive-terms Return the most "relevant" terms in the model nodes (that is, the terms with the highest scores).
cts:element-walk Returns a copy of the node, replacing any elements found with the specified expression.
cts:entity-highlight Returns a copy of the node, replacing any entities found with the specified expression.
cts:fitness Returns the fitness of a node, or of the context node if no node is provided.
cts:highlight Returns a copy of the node, replacing any text matching the query with the specified expression.
cts:quality Returns the quality of a node, or of the context node if no node is provided.
cts:register Register a query for later use.
cts:remainder Returns an estimated search result size for a node, or of the context node if no node is provided.
cts:score Returns the score of a node, or of the context node if no node is provided.
cts:search Returns a relevance-ordered sequence of nodes specified by a given query.
cts:stem Returns the stem(s) for a word.
cts:tokenize Tokenizes text into words, punctuation, and spaces.
cts:walk Walks a node, evaluating an expression with any text matching a query.