Class: options

mljs# options

new options()

Creates a new search options builder connected to this client database connection mljs instance. Each function returns a reference to the option builder object to support chaining.

Deprecated:
  • Use var db = new mljs(); db.createOptions(); instead
    Source:

    Methods

    addConstraint(con)

    Adds any new constraint JSON to the search options object. Always called by the *Constraint methods themselves anyway. This is for any constraints you wish to add that don't have their own method here.

    Parameters:
    Name Type Description
    con JSON

    Constraint JSON to add to these options.

    Source:

    additionalQuery(str)

    Specifies the additional query to use to filter any search results

    Parameters:
    Name Type Description
    str string

    The additional query string (XML string of a CTS query) to use

    Source:

    annotate(constraint_name, annotation)

    Add an annotation to a constraint after the constraint has been configured. Useful for lazy loading localised strings.

    Parameters:
    Name Type Description
    constraint_name string

    the name of the constraint in these options

    annotation string | Array

    the annotation string, or array of strings

    Source:

    buckets(constraint_name)

    Adds fixed buckets for the specified constraint. Returns a JSON object that has a bucket(lt,ge,name_opt,label_opt) method. Used like this:-

    var yearBuckets = ob.buckets(year);
    yearBuckets.bucket(1920,1929,"1920s","The 1920s").bucket(...).bucket(...);

    Note: If you don't specify name, MLJS will create a string based on "gevalue-ltvalue". If you don't specify label, it will default to the name specified or calculated by MLJS

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint to define buckets for.

    Source:

    collectionConstraint(constraint_name_opt, prefix, facet_option_opt, annotation_opt)

    Create a collection constraint, and adds it to the search options object

    Parameters:
    Name Type Description
    constraint_name_opt string

    Optional constraint name to use. Defaults to 'collection'

    prefix string

    Optional prefix (base collection) to use. Defaults to blank ''. I.e. all collections

    facet_option_opt JSON

    Optional JSON facet configureation. If not configured, will use the default facet configuration

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    computedBuckets(constraint_name)

    Adds Computed buckets for the specified constraint. Returns a JSON object that has a bucket(lt,ge,name_opt,label_opt) method. Used like this:-

    var timeBuckets = ob.buckets("updated");
    timeBuckets.bucket("P0D","P1D","now","today","Today").bucket(...).bucket(...);

    Note: If you don't specify name, MLJS will create a string based on "gevalue-ltvalue". If you don't specify label, it will default to the name specified or calculated by MLJS

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint to define buckets for.

    Source:

    concurrencyLevel(level)

    Specified the concurrency level option

    Parameters:
    Name Type Description
    level string

    REST API concurrency level to use

    Source:

    customConstraint(constraint_name, parsefunction, parsenamesapce, parselibrary, startfunction, startnamesapce, startlibrary, finishfunction, finishnamesapce, finishlibrary, annotation_opt, additional_properties_opt)

    Defines a custom constraint. To skip one of parse, start or finish, set the function parameter to null.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_87763

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint to create

    parsefunction string

    The function local name

    parsenamesapce string

    The namespace of the function

    parselibrary string

    The XQuery library path in the modules database for the function

    startfunction string

    The function local name

    startnamesapce string

    The namespace of the function

    startlibrary string

    The XQuery library path in the modules database for the function

    finishfunction string

    The function local name

    finishnamesapce string

    The namespace of the function

    finishlibrary string

    The XQuery library path in the modules database for the function

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    additional_properties_opt json

    Additional rest api properties to apply to this constraint. Copied after constraint constructed. E.g. fragmentScope.

    Source:

    debug(dbg)

    Specified the debug level for the search

    Parameters:
    Name Type Description
    dbg string

    Search API debug level to use

    Source:

    defaultCollation(col)

    Specifies the default collation applies to all string constraints and sorts, if not specified on constraint definition

    Parameters:
    Name Type Description
    col string

    The default collation URL spec to use

    Source:

    defaultLimit(num)

    Sets the default limit for values and tuples lookups (co-occurence and lexicon value listing)

    Parameters:
    Name Type Description
    num postitiveInteger

    The limit of the number of results to return

    Source:

    defaultNamespace(ns)

    Specifies the default element namespace to use

    Parameters:
    Name Type Description
    ns string

    Sets the default namespace value

    Source:

    defaultSortOrder(sort)

    Specifies the default sort order

    Parameters:
    Name Type Description
    sort string

    The default sort order. 'ascending' (default) or 'descending'.

    Source:

    defaultType(type)

    Specifies the default constraint type

    Parameters:
    Name Type Description
    type string

    Sets the default type (default is xs:string)

    Source:

    elemattrRangeConstraint(constraint_name, elment, namespace, attr, type_opt, collation_opt, facet_opt, facet_options_opt, annotation_opt)

    Creates a new element attribute range constraint, and adds it to the search options object

    Parameters:
    Name Type Description
    constraint_name string

    Constraint name to use.

    elment string

    Element name to use

    namespace string

    Namespace to use.

    attr string

    Element attribute to use

    type_opt string

    XML Schema type. E.g. "xs:string". Optional. If not specified, default type is used.

    collation_opt string

    The optional string collation to used. If not specified, default collation is used (if of xs:string type)

    facet_opt boolean

    Whether to use this constraint as a facet

    facet_options_opt JSON

    The optional facet configuration JSON to use.

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    elementConstraint(constraint_name, elementname, elementns, annotation_opt)

    Restricts all search parameters to the specified element.

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint to create

    elementname string

    The name of the element to match

    elementns string

    The namespace of the element to match

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Deprecated:
    Source:

    elementContainerConstraint(constraint_name, elementname, elementns, annotation_opt)

    Restricts all search parameters to the specified element.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_62771

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint to create

    elementname string

    The name of the element to match

    elementns string

    The namespace of the element to match

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    empty()

    Uses empty snippet document snippeting mode.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_48012

    Source:

    extractAttributeMetadata(elementname, elementns, attributename, attributens_opt)

    Extracts metadata for a single element's attribrute.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_41417

    Parameters:
    Name Type Description
    elementname string

    Local name of the element to extract

    elementns string

    Namespace of the element to extract

    attributename string

    Local name of the attribute

    attributens_opt string

    Optional namespace of the attribute to extract. Defaults if not specified to the element namespace

    Source:

    extractConstraintMetadata(constraint_name)

    Extracts metadata for a single constraint

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_41417

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint whose content should be extracted

    Source:

    extractElementMetadata(elementname, elementns)

    Extracts metadata for a single element.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_41417

    Parameters:
    Name Type Description
    elementname string

    Local name of the element to extract

    elementns string

    Namespace of the element to extract

    Source:

    extractJsonMetadata(strings)

    Extracts metadata from a json key value.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_41417

    Parameters:
    Name Type Description
    strings string | Array

    Single string or string array containing json key names

    Source:

    fieldRangeConstraint(constraint_name, name, type_opt, collation_opt, facet_opt, facet_options_opt, fragmentScope_opt, annotation_opt)

    Specifies a new field range constraint, and adds it to the search options object

    Parameters:
    Name Type Description
    constraint_name string

    Constraint name to use

    name string

    Field name to use

    type_opt string

    xs:string or similar

    collation_opt string

    The optional string collation to used. If not specified, default collation is used

    facet_opt boolean

    Use this constraint as a facet.

    facet_options_opt JSON

    The optional facet configuration JSON to use.

    fragmentScope_opt string

    The fragment to use (defaults to document)

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    forest(forests)

    Specified the forest to search within

    Parameters:
    Name Type Description
    forests positiveInteger | Array

    Which forest(s) to use. (Note: MarkLogic internal IDs can overload JavaScript's numeric types so must be used with caution.)

    Source:

    fragmentScope(scope)

    Specified the fragment scope

    Parameters:
    Name Type Description
    scope string

    Function scope to use

    Source:

    geoAttributePairConstraint(constraint_name, parentelement, parentns, latattr, latns, lonattr, lonns, heatmap_opt, geo_options_opt, facet_opt, facet_options_opt, annotation_opt, additional_properties_opt)

    Specifies a geospatial element attribute pair constraint, and adds it to the search options object

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_41124 NB Requires WGS84 or RAW co-ordinates (depending on how you are storing your data) - See the proj4js project for conversions

    Parameters:
    Name Type Description
    constraint_name string

    Name of the constraint to create

    parentelement string

    Parent element name

    parentns string

    Optional namespace of the parent element. If not provided, uses the default namespace

    latattr string

    Attribute name of the latitude attribute within the parent

    latns string

    Namespace of the latitude element within the parent

    lonattr string

    Attribute name of the longitude Attribute within the parent

    lonns string

    Namespace of the longitude element within the parent

    heatmap_opt json

    Optional heatmap json configuration

    geo_options_opt Array

    Optional array of strings to use as options for this geo constraint

    facet_opt boolean

    Whether to include this constraint as a facet

    facet_options_opt json

    Options for the facet based on this constraint

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    additional_properties_opt json

    Additional rest api properties to apply to this constraint. Copied after constraint constructed. E.g. fragmentScope.

    Source:

    geoElementConstraint(constraint_name, parent, ns_opt, element, ns_el_opt, annotation_opt, additional_properties_opt)

    Create a geospatial element pair constraint, and adds it to the search options object

    Parameters:
    Name Type Description
    constraint_name string

    Name of the constraint to create

    parent string

    Parent element name

    ns_opt string

    Optional namespace of the parent element. If not provided, uses the default namespace

    element string

    Element name of the geospatial pair element

    ns_el_opt string

    Optional namespace of the child geospatial element. If not configured will use the default namespace

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    additional_properties_opt json

    Additional rest api properties to apply to this constraint. Copied after constraint constructed. E.g. fragmentScope.

    Source:

    geoElementPairConstraint(constraint_name, parentelement, parentns, latelement, latns, lonelement, lonns, heatmap_opt, geo_options_opt, facet_opt, facet_options_opt, annotation_opt, additional_properties_opt)

    Creates an element pair geo constraint.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_33146 NB Requires WGS84 or RAW co-ordinates (depending on how you are storing your data) - See the proj4js project for conversions

    Parameters:
    Name Type Description
    constraint_name string

    Name of the constraint to create

    parentelement string

    Parent element name

    parentns string

    Optional namespace of the parent element. If not provided, uses the default namespace

    latelement string

    Element name of the latitude element within the parent

    latns string

    Namespace of the latitude element within the parent

    lonelement string

    Element name of the longitude element within the parent

    lonns string

    Namespace of the longitude element within the parent

    heatmap_opt json

    Optional heatmap json configuration

    geo_options_opt Array

    Optional array of strings to use as options for this geo constraint

    facet_opt boolean

    Whether to include this constraint as a facet

    facet_options_opt json

    Options for the facet based on this constraint

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    additional_properties_opt json

    Additional rest api properties to apply to this constraint. Copied after constraint constructed. E.g. fragmentScope.

    Source:

    geoPathConstraint(constraint_name, path, namespace_json, annotation_opt, additional_properties_opt)

    Creates a geospatial path range index constraint.

    Assumes the value of the element is "lat,lon". This can be reversed using the "long-lat-point" option. See the below URL for details.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_86685 NB Requires WGS84 or RAW co-ordinates (depending on how you are storing your data) - See the proj4js project for conversions

    NOTE: Any namespaces used in the XPath must be specified as {a: "myns1", b: "myns2"} in namespace_json

    Parameters:
    Name Type Description
    constraint_name string

    Name of the constraint to create

    path string

    The XPath of the element containing the coordinates.

    namespace_json json

    The namespace json to use. null if no namespaces are used in the path

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    additional_properties_opt json

    Additional rest api properties to apply to this constraint. Copied after constraint constructed. E.g. fragmentScope.

    Source:

    getConstraint(name)

    Returns a constraint definition based on constraint name.

    Parameters:
    Name Type Description
    name string

    Constraint name for already defined constraint to return

    Source:

    getFacetValueString(facetname, facetvalue)

    Returns the translated value for a given facet raw value.

    Parameters:
    Name Type Description
    facetname string

    The name of the facet (same as the constraint name by default)

    facetvalue string

    The raw facet value returned by MarkLogic

    Source:

    grouping(label, delimiter, strength, additional_properties)

    Convenience method for defining a custom grammar starter. See starter() also.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_50275

    Parameters:
    Name Type Description
    label string

    the first encountered character to indicate this is a starter (E.g. '(' or '-' characters)

    delimiter string

    The trailing character to denote the end of this group. E.g. the ')' character. (Start character defined in 'label')

    strength integer

    Precedence of this starter over others

    additional_properties json

    Other properties to add. E.g. element, delimiter, ns, at, tokenize

    Source:

    implicit(ctsquery)

    The cts-query literal to use to join two terms together. See implicitAnd() and implicitOr() for convenience methods. Defaults to and-query.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_13284

    Parameters:
    Name Type Description
    ctsquery string

    The serialized CTS query to use to join two terms together. See REST API docs for example.

    Source:

    implicitAnd()

    Convenience function to specify an and-query as a term joiner for a custom grammar.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_13284

    Source:

    implicitOr()

    Convenience function to specify an or-query as a term joiner for a custom grammar.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_13284

    Source:

    joiner(label, apply, strength, additional_properties)

    Adds a joiner configuration to the custom search grammar definition.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_37224

    Parameters:
    Name Type Description
    label string

    The joiner word. E.g. "OR" or "AND"

    apply string

    Local name of the function. E.g. "infix"

    strength integer

    Precedence of this joiner over others

    additional_properties json

    Other properties to add. E.g. element, options, tokenize etc

    Source:

    jsonContainerConstraint(constraint_name, jsonkey, annotation_opt)

    Restricts all search parameters to the specified json key.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_62771

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint to create

    jsonkey string

    The name of the json property (key) to match

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    jsonRangeConstraint(name_or_key, type_opt, collation_opt, facet_opt, facet_options_opt, fragmentScope_opt, annotation_opt)

    Convenience method to create a range constraint for a JSON key (uses the MarkLogic basic JSON namespace)

    Parameters:
    Name Type Description
    name_or_key string

    JSON key to use

    type_opt string

    Whether to use 'json' (default) or 'xml' element matching

    collation_opt string

    The optional string collation to used. If not specified, default collation is used

    facet_opt boolean

    Include this constraint as a facet?

    facet_options_opt JSON

    The optional facet configuration JSON to use.

    fragmentScope_opt string

    The fragment to use (defaults to document)

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    metadata()

    Uses metadata-snippet document snippeting mode.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_48012

    Source:

    noDLSVersions()

    Sets additional query to one that ensures no DLS declared document versions are returned (except the latest version at the original URL).

    Source:

    pageLength(length)

    Specifies the number of search results to return on each page

    Parameters:
    Name Type Description
    length positiveInteger

    Page length to use. If not specified, uses the default (10).

    Source:

    pathConstraint(constraint_name, xpath, namespaces, type_opt, collation_opt, facet_opt, facet_options_opt, annotation_opt)

    Generates a new Xpath constraint

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint

    xpath string

    The XPath path

    namespaces json

    The {prefix: "http://name/space/", ...} JSON listing namespaces to use

    type_opt string

    The type of the XPath attribute/element pointed at. Defaults to xs:string. Must have xs: prefix.

    collation_opt string

    The collation to use (if an xs:string), defaults to the value of defaultCollation in this options builder instance

    facet_opt boolean

    Whether to use this in a facet. Defaults to true. NB CURRENTLY THE REST API DOES NOT SUPPORT XPATH FACETS

    facet_options_opt Array

    Additional string array XPath options - See http://docs.marklogic.com/guide/rest-dev/appendixa#id_64714

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    prefix(label, element, strength, additional_properties)

    Convenience method for defining a custom grammar starter. See starter() also.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_50275

    Parameters:
    Name Type Description
    label string

    the first encountered character to indicate this is a starter (E.g. '(' or '-' characters)

    element string

    Query to use. E.g. "cts:not-query"

    strength integer

    Precedence of this starter over others

    additional_properties json

    Other properties to add. E.g. element, delimiter, ns, at, tokenize

    Source:

    propertiesConstraint(constraint_name_opt)

    Adds a properties constraint to the search options. Forces the entire search to be constrained to the properties fragment only.

    Parameters:
    Name Type Description
    constraint_name_opt string

    Optional name of the constraint to create

    Source:

    qualityWeight(weight)

    Specified the quality weight

    Parameters:
    Name Type Description
    weight double

    Default search weight to use.

    Source:

    quotation(quotation)

    Specifies the quotation character for this custom grammar

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_13284

    Parameters:
    Name Type Description
    quotation string

    Quotation character. E.g. "\""

    Source:

    rangeConstraint(constraint_name_opt, name_or_key, ns_opt, type_opt, collation_opt, facet_opt, facet_options_opt, fragmentScope_opt, annotation_opt)

    Specifies a new range constraint, and adds it to the search options object

    Parameters:
    Name Type Description
    constraint_name_opt string

    Optional constraint name to use. Defaults to NULL

    name_or_key string

    Element name or JSON key to use

    ns_opt string

    Namespace to use. Optional. If not specified, default namespace is used. (If type is XML element)

    type_opt string

    Whether to use 'json' (default) or 'xml' element matching

    collation_opt string

    The optional string collation to used. If not specified, default collation is used

    facet_opt boolean

    Include this constraint as a facet?

    facet_options_opt JSON

    The optional facet configuration JSON to use.

    fragmentScope_opt string

    The fragment to use (defaults to document)

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    raw()

    Source:

    returnAggregates(ret)

    Specified whether to return aggregates

    Parameters:
    Name Type Description
    ret boolean

    Whether to return aggregate values.

    Source:

    returnConstraints(ret)

    Specified whether to return constraints

    Parameters:
    Name Type Description
    ret boolean

    Whether to return query constraint settings in the response.

    Source:

    returnFacets(ret)

    Specified whether to return facets

    Parameters:
    Name Type Description
    ret boolean

    Whether to return facets

    Source:

    returnFrequencies(ret)

    Specified whether to return frequencies

    Parameters:
    Name Type Description
    ret boolean

    Whether to return Frequencies

    Source:

    returnMetrics(ret)

    Specified whether to return search metrics

    Parameters:
    Name Type Description
    ret boolean

    Whether to return search metrics.

    Source:

    returnPlan(ret)

    Specifies whether to return the internal search plan generated by the search query (Useful to debug poorly performing queries)

    Parameters:
    Name Type Description
    ret boolean

    Whether to return the internal search API plan. Useful to debug search performance issues.

    Source:

    returnQtext(ret)

    Specifies whether to return the query text with the search results

    Parameters:
    Name Type Description
    ret boolean

    Whether to returnthe query text with the response.

    Source:

    returnQuery(ret)

    Specifies whether to return the entire query with the search results

    Parameters:
    Name Type Description
    ret boolean

    Whether to return th query with the response.

    Source:

    returnResults(ret)

    Specifies whether to return search result documents (or snippets thereof)

    Parameters:
    Name Type Description
    ret boolean

    Whether to return search results. (Useful if you're just doing a values() co-occurence or lexicon lookup)

    Source:

    returnSimilar(ret)

    Specifies whether to return cts:similar documents to those in the search results

    Parameters:
    Name Type Description
    ret boolean

    Whether to return cts:similar documents for each search match.

    Source:

    returnValues(ret)

    Specifies whether to return values objects

    Parameters:
    Name Type Description
    ret boolean

    Whether to return values (co-occurence) matches with the response. (applies to /v1/values calls only)

    Source:

    searchableExpression(path, namespace_json)

    Restricts the query to the specified XPath searchable expression.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_65046

    NOTE: Any namespaces used in the XPath must be specified as {a: "myns1", b: "myns2"} in namespace_json

    Parameters:
    Name Type Description
    path string

    The XPath of the element to restrict search constraints to.

    namespace_json json

    The namespace json to use. null if no namespaces are used in the path

    Source:

    searchableExpression(expression, namespaces_opt)

    Restricts results (e.g. for snippeting) to those elements within the given XPath expression. Facets still operate at the document level even if they are not within the searchable expression.

    http://docs-ea.marklogic.com/guide/rest-dev/appendixa#id_65046

    Parameters:
    Name Type Description
    expression string

    The XPath expression to return in the search results (E.g. for snippeting)

    namespaces_opt string

    A JSON object of {prefix: "namespace/string", ...} specifying namespaces used within the XPath (if any)

    Source:

    searchOptions(searchOptions)

    Specifies the search options to configure. E.g. filtered, unfiltered, score-logtfidf.

    http://docs.marklogic.com/6.0/cts:search?q=cts:search

    Parameters:
    Name Type Description
    searchOptions string | Array

    A single string option, or string array, holding search options.

    Source:

    setFacetValueStrings(facetname, valuehash)

    Sets the matrix of facet values. Useful to translate codes on the fly to human readable values in facets. This lives in the options object as a convenience for objects to populate strings and retrieve displayable values. This is NOT a feature of the core REST API exposed in the Options object, but a convenience built over them.

    Parameters:
    Name Type Description
    facetname string

    The name of the facet (same as the constraint name by default) these values apply to

    valuehash json

    A JSON object with raw facet values as keys, and translated (for display) values as values - { "SOME/value": "Some value", ... }

    Source:

    snippet(ns_opt, at_opt, additional_opt)

    Uses default snippeting document snippeting mode.

    NB To configure default snippeting function use snippet(null,null,{"max-matches": 10}) or similar

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_48012

    Parameters:
    Name Type Description
    ns_opt string

    The optional XQuery namespace of the snippeting module to invoke

    at_opt string

    The relative location in the REST modules database to find the snippeting module to invoke

    additional_opt json

    Map containing additional properties. E.g. "preferred-elements" or "max-matches"

    Source:

    sortOrder(direction_opt, type_opt, keyOrJSON, collation_opt)

    Specifies the sort order. Automatically called for any of the range constraint constructor functions.

    Parameters:
    Name Type Description
    direction_opt string

    The direction (ascending or descending) to use. If not specified, uses the default direction.

    type_opt string

    The type of the sort element. If not specified uses the default type.

    keyOrJSON string | JSON

    The JSON key or XML index JSON description to use. {element: "year", elementns: "http://...", attribute: "gregorian", attributens: "http://" OR FOR FIELD: field: "myfield", collation: "http://..." OR JSON key: "key" - All support annotation: "" | ["","",...] }

    collation_opt string

    The optional collation to use. Uses the default collation if not specified.

    Source:

    sortOrderClear()

    Clears any default or specified sort order definitions

    Source:

    sortOrderScore()

    Specifies score as the sort order

    Source:

    starter(label, apply, strength, additional_properties)

    Defines a Custom Grammar starter. This enables term grouping (E.g. ( and ) is a group) and prefixing (E.g. negation). See also the convenience grouping() and prefix() methods.

    http://docs.marklogic.com/guide/rest-dev/appendixa#id_50275

    Parameters:
    Name Type Description
    label string

    the first encountered character to indicate this is a starter (E.g. '(' or '-' characters)

    apply string

    Whether this should be a "grouping" or "prefix" starter

    strength integer

    Precedence of this starter over others

    additional_properties json

    Other properties to add. E.g. element, delimiter, ns, at, tokenize

    Source:

    thesaurusConstraint(constraint_name, additional_properties_opt)

    Adds a thesaurus constraint to these options. Uses a custom constraint. NOTE: You MUST alter the custom constraint to specify your own thesaurus xml file. This should be only as large as your application requires.

    https://github.com/adamfowleruk/mljs/tree/master/mldbwebtest/src/app/models/lib-thesaurus.xqy

    Parameters:
    Name Type Description
    constraint_name string

    The name of the constraint to create

    additional_properties_opt json

    Additional rest api properties to apply to this constraint. Copied after constraint constructed. E.g. fragmentScope.

    Source:

    toJson()

    Returns the JSON search options object needed by the REST API and generated by this class

    Source:

    transformResults(apply, ns_opt, at_opt)

    Specifies the results transformation options. Defaults to raw (full document returned).

    Parameters:
    Name Type Description
    apply string

    The XQuery function name

    ns_opt string

    The optional XQuery namespace of the module to invoke

    at_opt string

    The relative location in the REST modules database to find the transform to invoke

    Source:

    tuples(name, el)

    Creates a tuples definition for returning co-occurence values

    Parameters:
    Name Type Description
    name string

    The name of the tuples configuration to create

    el string | JSON

    The json element for a co-occurence. Either a range constraint name, element/json key name (string) or a full REST API range type object (JSON). You can specify any number of these as required (minimum 2)

    Source:

    valueConstraint(constraint_name_opt, name_or_key, ns_opt, fragmentScope_opt, annotation_opt)

    Creates a new value Constraint, and adds it to the search options object

    MarkLogic does not support faceting or sorting for value constraints - add a range constraint and range index for this functionality.

    Parameters:
    Name Type Description
    constraint_name_opt string

    Optional constraint name to use. Defaults to NULL

    name_or_key string

    Element name or JSON key to use

    ns_opt string

    Namespace to use. Optional. If not specified, default namespace is used. (If type is XML element)

    fragmentScope_opt string

    The fragment to use (defaults to document)

    annotation_opt string | Array

    The annotation to add to the constraint. MLJS uses annotation[0] as the display title, falling back to camel case constraint name if not specified

    Source:

    values(name, el)

    Creates a values definition for returning lexicon values

    Parameters:
    Name Type Description
    name string

    The name of the values configuration to create

    el string | JSON

    The json element for a co-occurence. Either a range constraint name, element/json key name (string) or a full REST API range type object (JSON). You can specify any number of these as required

    Source:
    MLJS - A JavaScript wrapper for the MarkLogic REST API
    MarkLogic 2012-2014
    Documentation generated by JSDoc 3.2.3-dev on Mon Jul 18 2016 09:14:12 GMT+0100 (BST) using the DocStrap template.