MarkLogic 9 Product Documentation
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 and JSON structured text. Searches that use these functions use the indexes and are designed to return results quickly.

Though you can use these functions from both XQuery and Server-Side JavaScript, JavaScript developers should consider using the fluent native JavaScript Search (jsearch) API instead. For details, see Creating JavaScript Search Applications in the Search Developer's Guide.

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.elementValues, 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.

25 functions
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.distinctiveTerms Return the most "relevant" terms in the model nodes (that is, the terms with the highest scores).
cts.doc Returns the document stored in the database at the specified URI.
cts.elementWalk Returns a copy of the node, replacing any elements found with the specified expression.
cts.entity Returns a cts:entity object.
cts.entityDictionary Returns a cts:entity-dictionary object.
cts.entityDictionaryGet Retrieve an entity dictionary previously cached in the database.
cts.entityDictionaryParse Construct a cts:entity-dictionary object by parsing it from a formatted string.
cts.entityHighlight Find entities in a node and replace each matched entity with the result returned by a callback function.
cts.entityWalk Walk an XML document or element node, evaluating a callback function 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.partOfSpeech 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.relevanceInfo 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 a callback function for any text matching a query.
Powered by MarkLogic Server | Terms of Use | Privacy Policy