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.
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.
-
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
-
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
-
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.
-
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
-
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.
-
concurrencyLevel(level)
-
Specified the concurrency level option
Parameters:
Name Type Description level
string REST API concurrency level to use
-
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.
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.
-
debug(dbg)
-
Specified the debug level for the search
Parameters:
Name Type Description dbg
string Search API debug level to use
-
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
-
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
-
defaultNamespace(ns)
-
Specifies the default element namespace to use
Parameters:
Name Type Description ns
string Sets the default namespace value
-
defaultSortOrder(sort)
-
Specifies the default sort order
Parameters:
Name Type Description sort
string The default sort order. 'ascending' (default) or 'descending'.
-
defaultType(type)
-
Specifies the default constraint type
Parameters:
Name Type Description type
string Sets the default type (default is xs:string)
-
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
-
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:
- See {@see #elementContainerConstraint} . http://docs.marklogic.com/guide/rest-dev/appendixa#id_62771
- Source:
-
elementContainerConstraint(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
-
empty()
-
Uses empty snippet document snippeting mode.
-
extractAttributeMetadata(elementname, elementns, attributename, attributens_opt)
-
Extracts metadata for a single element's attribrute.
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
-
extractConstraintMetadata(constraint_name)
-
Extracts metadata for a single constraint
Parameters:
Name Type Description constraint_name
string The name of the constraint whose content should be extracted
-
extractElementMetadata(elementname, elementns)
-
Extracts metadata for a single element.
Parameters:
Name Type Description elementname
string Local name of the element to extract
elementns
string Namespace of the element to extract
-
extractJsonMetadata(strings)
-
Extracts metadata from a json key value.
Parameters:
Name Type Description strings
string | Array Single string or string array containing json key names
-
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
-
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.)
-
fragmentScope(scope)
-
Specified the fragment scope
Parameters:
Name Type Description scope
string Function scope to use
-
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.
-
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.
-
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.
-
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.
-
getConstraint(name)
-
Returns a constraint definition based on constraint name.
Parameters:
Name Type Description name
string Constraint name for already defined constraint to return
-
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
-
grouping(label, delimiter, strength, additional_properties)
-
Convenience method for defining a custom grammar starter. See starter() also.
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
-
implicit(ctsquery)
-
The cts-query literal to use to join two terms together. See implicitAnd() and implicitOr() for convenience methods. Defaults to and-query.
Parameters:
Name Type Description ctsquery
string The serialized CTS query to use to join two terms together. See REST API docs for example.
-
implicitAnd()
-
Convenience function to specify an and-query as a term joiner for a custom grammar.
-
implicitOr()
-
Convenience function to specify an or-query as a term joiner for a custom grammar.
-
joiner(label, apply, strength, additional_properties)
-
Adds a joiner configuration to the custom search grammar definition.
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
-
jsonContainerConstraint(constraint_name, jsonkey, annotation_opt)
-
Restricts all search parameters to the specified json key.
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
-
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
-
metadata()
-
Uses metadata-snippet document snippeting mode.
-
noDLSVersions()
-
Sets additional query to one that ensures no DLS declared document versions are returned (except the latest version at the original URL).
-
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).
-
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
-
prefix(label, element, strength, additional_properties)
-
Convenience method for defining a custom grammar starter. See starter() also.
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
-
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
-
qualityWeight(weight)
-
Specified the quality weight
Parameters:
Name Type Description weight
double Default search weight to use.
-
quotation(quotation)
-
Specifies the quotation character for this custom grammar
Parameters:
Name Type Description quotation
string Quotation character. E.g. "\""
-
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
-
raw()
-
Uses RAW document snippeting mode.
-
returnAggregates(ret)
-
Specified whether to return aggregates
Parameters:
Name Type Description ret
boolean Whether to return aggregate values.
-
returnConstraints(ret)
-
Specified whether to return constraints
Parameters:
Name Type Description ret
boolean Whether to return query constraint settings in the response.
-
returnFacets(ret)
-
Specified whether to return facets
Parameters:
Name Type Description ret
boolean Whether to return facets
-
returnFrequencies(ret)
-
Specified whether to return frequencies
Parameters:
Name Type Description ret
boolean Whether to return Frequencies
-
returnMetrics(ret)
-
Specified whether to return search metrics
Parameters:
Name Type Description ret
boolean Whether to return search metrics.
-
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.
-
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.
-
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.
-
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)
-
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.
-
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)
-
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
-
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)
-
searchOptions(searchOptions)
-
Specifies the search options to configure. E.g. filtered, unfiltered, score-logtfidf.
Parameters:
Name Type Description searchOptions
string | Array A single string option, or string array, holding search options.
-
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", ... }
-
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
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"
-
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.
-
sortOrderClear()
-
Clears any default or specified sort order definitions
-
sortOrderScore()
-
Specifies score as the sort order
-
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.
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
-
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.
-
toJson()
-
Returns the JSON search options object needed by the REST API and generated by this class
-
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
-
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)
-
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
-
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