The search built-in functions are XQuery functions used to perform text searches. The search functions are designed for use with XML and JSON structured text. Searches that use these functions use the indexes and are designed to return results quickly.
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.
Function name | Description |
---|---|
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 values 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 | Returns a cts:entity object. |
cts:entity-dictionary | Returns a cts:entity-dictionary object. |
cts:entity-dictionary-get | Retrieve an entity dictionary previously cached in the database. |
cts:entity-dictionary-parse | Construct a cts:entity-dictionary object by parsing it from a formatted string. |
cts:entity-highlight | Returns a copy of the node, replacing any entities found with the specified expression. |
cts:entity-walk | Walk an XML document or element node, evaluating an expression against any matching entities. |
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:parse | Parses a query string |
cts:part-of-speech | Returns the part of speech for a cts:token, if any. |
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:relevance-info | Return the relevance score computation report for a node. |
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. |