Loading TOC...

search functions

The table below lists all the search built-in functions (in this namespace: http://marklogic.com/appservices/search).

The Search function module is installed as the following file:

  • install_dir/Modules/MarkLogic/appservices/search/search.xqy

where install_dir is the directory in which MarkLogic Server is installed.

To use the search.xqy module in your own XQuery modules, include the following line in your XQuery prolog:

import module namespace search="http://marklogic.com/appservices/search"
                    at "/MarkLogic/appservices/search/search.xqy";

The Search functions are used to create search high-level results, facets, snippets, and other search-related items.

12 functions
Function name Description
search:check-options This function verifies that options XML is properly structured.
search:estimate This function quickly estimates the number of hits a query will return.
search:get-default-options This function returns the default options XML.
search:parse This function parses query text according to given options and returns the appropriate cts:query XML.
search:remove-constraint This function safely removes a token from query text, ensuring that grammar elements (AND, OR, quotes, parentheses) are handled properly.
search:resolve This function is the same as search:search, except that it takes a parsed and annotated cts:query XML node or a structured search search:query XML node as input.
search:resolve-nodes This function performs the same search as search:search, but it takes a parsed and annotated cts:query XML node or a structured search search:query XML node as input and returns the actual result nodes from the database.
search:search This function parses and invokes a query according to specified options, returning up to $page-length result nodes starting from $start.
search:snippet This function extracts matching text from the result node based on options, and returns the matches wrapped in a containing node, with highlights tagged.
search:suggest This function returns a sequence of suggested text strings that match a wildcarded search for the $qtext input, ready for use in a user interface.
search:unparse This function turns a serialized and annotated cts:query (typically from search:parse) back into query text according to the specified rules.
search:values This function returns lexicon values and allows you to calculate aggregates based on the lexicon values.