Namespace: valuesBuilder

valuesBuilder

A helper for building the definition of a values query, which projects tuples (aka rows) of values out of documents. The helper is created by the marklogic.valuesBuilder function. You must call the valuesBuilder#fromIndexes function to supply the required clause of the values query before calling the valuesBuilder.BuiltQuery#where, valuesBuilder.BuiltQuery#aggregates, valuesBuilder.BuiltQuery#slice, or valuesBuilder.BuiltQuery#withOptions functions to specify the optional clauses of the built query.

Namespaces

BuiltQuery

Methods


and(subquery, ordering) → {queryBuilder.Query}

Builds a query for the intersection of the subqueries.
Parameters:
Name Type Argument Description
subquery queryBuilder.Query <repeatable>
a word, value, range, geospatial, or other query or a composer such as an or query.
ordering queryBuilder.OrderParam <optional>
the ordering on the subqueries returned from queryBuilder#ordered
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

andNot(positiveQuery, negativeQuery) → {queryBuilder.Query}

Builds a query with positive and negative subqueries.
Parameters:
Name Type Description
positiveQuery queryBuilder.Query a query that must match the result documents
negativeQuery queryBuilder.Query a query that must not match the result documents
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

attribute(element, attribute) → {queryBuilder.IndexedName}

Specifies an XML attribute for a query. A name without a namespace can be expressed as a string. A namespaced name can be expressed as a two-item array with uri and name strings or as an object returned by the queryBuilder#qname function.
Parameters:
Name Type Description
element string | Array.<string> | queryBuilder.QName the name of the element
attribute string | Array.<string> | queryBuilder.QName the name of the attribute
Since:
  • 1.0
Returns:
an indexed name for specifying a query
Type
queryBuilder.IndexedName

boost(matchingQuery, boostingQuery) → {queryBuilder.Query}

Builds a query with matching and boosting subqueries.
Parameters:
Name Type Description
matchingQuery queryBuilder.Query a query that must match the result documents
boostingQuery queryBuilder.Query a query that increases the ranking when qualifying result documents
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

box(south, west, north, east) → {queryBuilder.Region}

Specifies a rectangular region with the coordinates of the corners. The coordinates can be specified either by passing the return value from the queryBuilder#southWestNorthEast function or as a list of {queryBuilder.LatLon} coordinates in South, West, North, and East order.
Parameters:
Name Type Description
south queryBuilder.LatLon the south coordinate of the box
west queryBuilder.LatLon the west coordinate for the box
north queryBuilder.LatLon the north coordinate for the box
east queryBuilder.LatLon the east coordinate for the box
Since:
  • 1.0
Returns:
the region criteria for a geospatial query
Type
queryBuilder.Region

circle(radius, center) → {queryBuilder.Region}

Specifies a circular region based on a radius and the coordinate of the center. The coordinate can either be specified by passing the return value from the queryBuilder#latlon function or by passing the latitude and longitude numbers in that order (possibly wrapped in an array).
Parameters:
Name Type Description
radius number the radius for the circle
center queryBuilder.LatLon the center for the circle
Since:
  • 1.0
Returns:
the region criteria for a geospatial query
Type
queryBuilder.Region

collection(collections, prefix) → {queryBuilder.Query}

Builds a query matching documents in one or more collections as part of a document query. The collections can be specified as arguments or parsed from a query string based on a binding. Also, as part of a values query, the collection() function identifies the collection index without supplying criteria. In a values query, the tuples (aka rows) projected from each document have a column whose values are the collections to which the document belongs.
Parameters:
Name Type Argument Description
collections string | Array.<string> | queryBuilder.BindingParam either one or more collection uris to match or exactly one binding (returned by the queryBuilder#bind function) for parsing the collection uris from a query string; required except for values queries
prefix string <optional>
a prefix to prepend to each value provided by the parsed query string; can be provided only when providing a binding
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

copyFrom(query) → {valuesBuilder.BuiltQuery}

Initializes a new values builder by copying the from indexes clause and any where, aggregates, slice, or withOptions clause defined in the built query.
Parameters:
Name Type Description
query valuesBuilder.BuiltQuery an existing values query with clauses to copy
Since:
  • 1.0
Returns:
a built query
Type
valuesBuilder.BuiltQuery

datatype(datatype, collation) → {queryBuilder.DatatypeParam}

Identifies the datatype of an index.
Parameters:
Name Type Argument Description
datatype string a value from the enumeration int|unsignedInt|long|unsignedLong|float|double|decimal|dateTime|time|date|gYearMonth|gYear|gMonth|gDay|yearMonthDuration|dayTimeDuration|string|anyURI|point
collation string <optional>
a URI identifying the comparison method for a string or anyURI datatype
Since:
  • 1.0
Returns:
a datatype specification
Type
queryBuilder.DatatypeParam

directory(uris, infinite) → {queryBuilder.Query}

Builds a query matching documents in one or more database directories.
Parameters:
Name Type Argument Description
uris string | Array.<string> one or more directory uris to match
infinite boolean <optional>
whether to match documents at the top level or at any level of depth within the specified directories
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

document(uris) → {queryBuilder.Query}

Builds a query matching documents.
Parameters:
Name Type Description
uris string | Array.<string> one or more document uris to match
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

documentFragment(query) → {queryBuilder.Query}

Builds a query that applies the subquery to document content by contrast with the queryBuilder#properties function.
Parameters:
Name Type Description
query queryBuilder.Query the query that must match document content
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

element(name) → {queryBuilder.IndexedName}

Specifies an XML element for a query. A name without a namespace can be expressed as a string. A namespaced name can be expressed as a two-item array with uri and name strings or as an object returned by the queryBuilder#qname function.
Parameters:
Name Type Description
name string | Array.<string> | queryBuilder.QName the name of the element
Since:
  • 1.0
Returns:
an indexed name for specifying a query
Type
queryBuilder.IndexedName

falseQuery() → {queryBuilder.Query}

Builds a query that matches no documents.
Since:
  • 2.0.1
Returns:
a composable query
Type
queryBuilder.Query

field(name, collation) → {queryBuilder.IndexedName}

Specifies a field for a query.
Parameters:
Name Type Argument Description
name string the name of the field
collation string <optional>
the collation of a field over strings
Since:
  • 1.0
Returns:
an indexed name for specifying a query
Type
queryBuilder.IndexedName

fragmentScope(scopeType) → {queryBuilder.FragmentScopeParam}

Configures a query to match documents based on document content or document metadata properties.
Parameters:
Name Type Description
scopeType string a value from the documents|properties enumeration where 'documents' queries document content and 'properties' queries document metadata properties
Since:
  • 1.0
Returns:
a fragment scope specification
Type
queryBuilder.FragmentScopeParam

fromIndexes(indexes) → {valuesBuilder.BuiltQuery}

Specifies the range or geospatial indexes or collection or uri lexicons from which to project columns in the response for the values query. The response has a tuple (aka row) for each co-occurrence of these indexes in the documents selected by the where clause. This function must be called on the values builder.
Parameters:
Name Type Description
indexes string | valuesBuilder.DatatypedValuesIndex a list of parameters or array specifying the JSON properties, XML elements or attributes, fields, or paths providing the range or geospatial indexes or the return value from the collection() or uri() helper functions to specify those lexicons.
Since:
  • 1.0
Returns:
a built query
Type
valuesBuilder.BuiltQuery

geoAttributePair(parent, latitude, longitude) → {queryBuilder.GeoLocation}

Specifies the geospatial locations represented by an XML attribute pair for passing to the queryBuilder#geospatial function.
Parameters:
Name Type Description
parent string | queryBuilder.QName the name of the element containing the attributes as returned by the queryBuilder#qname function
latitude string | queryBuilder.QName the name of the latitude attribute as returned by the queryBuilder#qname function
longitude string | queryBuilder.QName the name of the longitude attribute as returned by the queryBuilder#qname function
Since:
  • 1.0
Returns:
the specification for the geospatial locations
Type
queryBuilder.GeoLocation

geoElement(parent, element) → {queryBuilder.GeoLocation}

Specifies the geospatial locations represented by an XML element containing a comma-separated pair of latitude-longitude values for passing to the queryBuilder#geospatial function.
Parameters:
Name Type Argument Description
parent string | queryBuilder.QName <optional>
the optional name of the parent of the geospatial element as returned by the queryBuilder#qname function
element string | queryBuilder.QName the name of the element as returned by the queryBuilder#qname function
Since:
  • 1.0
Returns:
the specification for the geospatial locations
Type
queryBuilder.GeoLocation

geoElementPair(parent, latitude, longitude) → {queryBuilder.GeoLocation}

Specifies the geospatial locations represented by an XML element pair for passing to the queryBuilder#geospatial function.
Parameters:
Name Type Description
parent string | queryBuilder.QName the name of the containing parent element as returned by the queryBuilder#qname function
latitude string | queryBuilder.QName the name of the latitude element as returned by the queryBuilder#qname function
longitude string | queryBuilder.QName the name of the longitude element as returned by the queryBuilder#qname function
Since:
  • 1.0
Returns:
the specification for the geospatial locations
Type
queryBuilder.GeoLocation

geoOptions(options) → {queryBuilder.GeoOptionsParam}

Provides options modifying the default behavior of a queryBuilder#geospatial query.
Parameters:
Name Type Argument Description
options string <repeatable>
options supported for geospatial queries
Since:
  • 1.0
Returns:
options for the geospatial query
Type
queryBuilder.GeoOptionsParam

geoPath(path, namespaces, coordSystem) → {queryBuilder.GeoLocation}

Specifies the geospatial locations represented by a path index on JSON properties or XML elements containing a pair of latitude-longitude values for passing to the queryBuilder#geospatial function.
Parameters:
Name Type Description
path string | object the XPath for the path index as a string or as the return value of the queryBuilder#pathIndex function
namespaces object bindings between the prefixes in the path and namespace URIs
coordSystem queryBuilder.CoordSystem the coordinate system for the index
Since:
  • 1.0
Returns:
the specification for the geospatial locations
Type
queryBuilder.GeoLocation

geoProperty(parent, element) → {queryBuilder.GeoLocation}

Specifies the geospatial locations represented by a JSON property containing a pair of latitude-longitude values for passing to the queryBuilder#geospatial function.
Parameters:
Name Type Argument Description
parent string <optional>
the optional name of the parent of the geospatial property
element string the name of the geospatial property
Since:
  • 1.0
Returns:
the specification for the geospatial locations
Type
queryBuilder.GeoLocation

geoPropertyPair(parent, latitude, longitude) → {queryBuilder.GeoLocation}

Specifies the geospatial locations represented by a JSON property pair for passing to the queryBuilder#geospatial function.
Parameters:
Name Type Description
parent string the name of the containing parent property
latitude string the name of the latitude property
longitude string the name of the longitude property
Since:
  • 1.0
Returns:
the specification for the geospatial locations
Type
queryBuilder.GeoLocation

geospatial(location, weight, fragmentScope, geoOptions, criteria) → {queryBuilder.Query}

Builds a geospatial query or facet against a geospatial point index. For a query, you must supply either the {queryBuilder.Region} criteria or a binding to parse the region criteria from a query string but not both.
Parameters:
Name Type Argument Description
location queryBuilder.GeoLocation the JSON property or XML element representing the geospatial locations
weight queryBuilder.WeightParam <optional>
a weight returned by queryBuilder#weight to increase or decrease the score of the query relative to other queries in the complete search
fragmentScope queryBuilder.FragmentScopeParam <optional>
whether the query applies to document content (the default) or document metadata properties as returned by the queryBuilder#fragmentScope function
geoOptions queryBuilder.GeoOptionsParam <optional>
a list of options returned by queryBuilder#geoOptions to modify the geospatial query
criteria queryBuilder.Region | queryBuilder.BindingParam <optional>
either a point matching or region containing geospatial locations in the documents or a binding (returned by the queryBuilder#bind function) for parsing the point or region from a query string
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

heatmap(latdivs, londivs, south, west, north, east) → {queryBuilder.HeatMapParam}

Divides a geospatial box into a two-dimensional grid for calculating facets based on document counts for each cell within the grid. The coordinates of the box can be specified either by passing the return value from the queryBuilder#southWestNorthEast function or as a list of {queryBuilder.LatLon} coordinates in South, West, North, and East order.
Parameters:
Name Type Description
latdivs number the number of latitude divisions in the grid
londivs number the number of longitude divisions in the grid
south queryBuilder.LatLon the south coordinate of the box
west queryBuilder.LatLon the west coordinate for the box
north queryBuilder.LatLon the north coordinate for the box
east queryBuilder.LatLon the east coordinate for the box
Since:
  • 1.0
Returns:
the buckets for a geospatial facet
Type
queryBuilder.HeatMapParam

latlon(latitude, longitude) → {queryBuilder.LatLon}

Specifies the latitude and longitude for a coordinate of the region criteria for a geospatial query. The latitude and longitude can be passed as individual numeric parameters or wrapped in an array
Parameters:
Name Type Description
latitude number the north-south location
longitude number the east-west location
Since:
  • 1.0
Returns:
a coordinate for a {queryBuilder.Region}
Type
queryBuilder.LatLon

locksFragment(query) → {queryBuilder.Query}

Builds a query that applies the subquery to document lock fragments by contrast with the queryBuilder#documentFragment function.
Parameters:
Name Type Description
query queryBuilder.Query the query that must match document lock fragments
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

lsqtQuery(temporalCollection, weight, timestamp, temporalOptions) → {queryBuilder.Query}

Builds a query matching temporal documents with a system start time prior to the LSQT (Latest System Query Time). Advancing the LSQT can be done manually or on an automated basis to include more recent temporal documents in the result set.
Parameters:
Name Type Argument Description
temporalCollection string the name of the temporal collection that retains the temporal documents
weight queryBuilder.WeightParam <optional>
a weight returned by queryBuilder#weight to increase or decrease the score of subqueries relative to other queries in the complete search
timestamp string | Date <optional>
a datetime older than the LSQT to use as the upper boundary for an older view of the database
temporalOptions queryBuilder.TemporalOptionsParam <optional>
a list of options returned by queryBuilder#temporalOptions to modify the temporal query
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

near(subquery, distance, weight, ordering, minDistance) → {queryBuilder.Query}

Builds a query that matches the subqueries within a specified proximity. Note that you may get false positives from a near query if you do not have the appropriate position index enabled or run the query unfiltered (which is the default). While turning on filtering can be convenient during development, setting up indexes is recommended for production.
Parameters:
Name Type Argument Description
subquery queryBuilder.Query <repeatable>
a word, value, range, geospatial, or other query or a composer such as an or query.
distance number <optional>
the maximum number of words between any two matching subqueries
weight queryBuilder.WeightParam <optional>
a weight returned by queryBuilder#weight to increase or decrease the score of subqueries relative to other queries in the complete search
ordering queryBuilder.OrderParam <optional>
the ordering on the subqueries returned from queryBuilder#ordered
minDistance queryBuilder.MinDistanceParam <optional>
the minimum distance between any two matching subqueries returned from queryBuilder#minDistance
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

not(subquery) → {queryBuilder.Query}

Builds a query that removes any documents matched by the subquery.
Parameters:
Name Type Description
subquery queryBuilder.Query a word, value, range, geospatial, or other query or a composer such as an or query.
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

notIn(positiveQuery, negativeQuery) → {queryBuilder.Query}

Builds a query where the matching content qualifies for the positive query and does not qualify for the negative query. Positions must be enabled for indexes.
Parameters:
Name Type Description
positiveQuery queryBuilder.Query a query that must match the content
negativeQuery queryBuilder.Query a query that must not match the same content
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

or(subquery) → {queryBuilder.Query}

Builds a query for the union intersection of subqueries.
Parameters:
Name Type Argument Description
subquery queryBuilder.Query <repeatable>
a word, value, range, geospatial, or other query or a composer such as an and query.
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

ordered(isOrdered) → {queryBuilder.OrderParam}

Specifies ordering for an queryBuilder#and or queryBuilder#near query.
Parameters:
Name Type Description
isOrdered boolean whether subqueries are ordered
Since:
  • 1.0
Returns:
a query flag for ordering
Type
queryBuilder.OrderParam

pathIndex(pathExpression, namespaces) → {queryBuilder.IndexedName}

Specifies a path configured as an index over JSON or XML documents on the server.
Parameters:
Name Type Description
pathExpression string the indexed path
namespaces object bindings between the prefixes in the path and namespace URIs
Since:
  • 1.0
Returns:
an indexed name for specifying a query
Type
queryBuilder.IndexedName

period(startTimestamp, endTimestamp) → {queryBuilder.PeriodParam}

Specifies a timespan or timestamp for comparison with a valid or system timespan in temporal documents in a queryBuilder#periodRange temporal query.
Parameters:
Name Type Argument Description
startTimestamp string | Date the starting datetime for a timespan or the datetime for a timestamp
endTimestamp string | Date <optional>
the starting datetime for a timespan or the datetime for a timestamp
Since:
  • 1.0
Returns:
the specification of a period for a queryBuilder#periodRange temporal query
Type
queryBuilder.PeriodParam

periodCompare(axis1, operator, axis2, temporalOptions) → {queryBuilder.Query}

Builds a query matching temporal documents based on the relationship between the valid period and the system period. For instance, this query can find cases where what was believed to be true (the valid time) was recorded (the system time) only afterward (the valid axis is before the system axis).
Parameters:
Name Type Argument Description
axis1 string the configured name of the valid or system axis
operator string the name of an Allen interval operator or ISO SQL 2011 period operator
axis2 string the configured name of the valid or system axis, which must be different from axis1
temporalOptions queryBuilder.TemporalOptionsParam <optional>
a list of options returned by queryBuilder#temporalOptions to modify the temporal query
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

periodRange(axis, operator, period, temporalOptions) → {queryBuilder.Query}

Builds a query matching temporal documents based on the relationship between the valid or system period and the specified period. This query can find what was believed to be true (the valid time) or was recorded (the system time) during a timespan or before or after a time.
Parameters:
Name Type Argument Description
axis string the configured name of the valid or system axis
operator string the name of an Allen interval operator or ISO SQL 2011 period operator
period queryBuilder.PeriodParam <optional>
a timespan or timestamp returned by queryBuilder#period to compare with the valid or system time of temporal documents
temporalOptions queryBuilder.TemporalOptionsParam <optional>
a list of options returned by queryBuilder#temporalOptions to modify the temporal query
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

point(coordinate) → {queryBuilder.Region}

Specifies a point region either by passing the return value from the queryBuilder#latlon function or by passing the latitude and longitude numbers in that order (possibly wrapped in an array).
Parameters:
Name Type Description
coordinate queryBuilder.LatLon the point location
Since:
  • 1.0
Returns:
the region criteria for a geospatial query
Type
queryBuilder.Region

polygon(coordinate) → {queryBuilder.Region}

Specifies a polygon region as a list of coordinate parameters or as a coordinate array where each coordinate is specified either by the return value from the queryBuilder#latlon function or by wrapping the latitude and longitude numbers in an array.
Parameters:
Name Type Argument Description
coordinate queryBuilder.LatLon <repeatable>
the polygon coordinates
Since:
  • 1.0
Returns:
the region criteria for a geospatial query
Type
queryBuilder.Region

property(name) → {queryBuilder.IndexedName}

Specifies a JSON property for a query. As a shortcut, a JSON property can also be specified with a string instead of calling this function.
Parameters:
Name Type Description
name string the name of the property
Since:
  • 1.0
Returns:
an indexed name for specifying a query
Type
queryBuilder.IndexedName

qname(parts) → {queryBuilder.QName}

Specifies an XML qualified name.
Parameters:
Name Type Description
parts string | Array.<string> the namespace URI and name for the QName supplied either as two strings or as an array with two strings.
Since:
  • 1.0
Returns:
a QName for identifying an element or attribute
Type
queryBuilder.QName

range(indexedName, datatype, comparison, binding, defaultBinding, weight, fragmentScope, options) → {queryBuilder.Query}

Builds a query over a range index. You must supply either a comparison operator with one or more values or a binding to parse the comparison and value from a query string but not both. You can provide both named and default bindings for the same query.
Parameters:
Name Type Argument Description
indexedName string | queryBuilder.IndexedName the JSON property, XML element or attribute, field, or path providing the values to the range index
datatype queryBuilder.DatatypeParam <optional>
a datatype returned by the queryBuilder#datatype to identify the index
comparison string <optional>
an operator from the enumeration =|!=|<|<=|>|>= defaulting to the = (equivalence) operator
...value <optional>
one or more values for comparison with the indexed values
binding queryBuilder.BindingParam <optional>
a binding (returned by the queryBuilder#bind function) for parsing the comparison operator and value from tagged values in a query string
defaultBinding queryBuilder.DefaultBindingParam <optional>
a binding (returned by the queryBuilder#bindDefault function) for parsing the comparison operator and value from untagged values in a query string
weight queryBuilder.WeightParam <optional>
a weight returned by queryBuilder#weight to increase or decrease the score of the query relative to other queries in the complete search
fragmentScope queryBuilder.FragmentScopeParam <optional>
whether the query applies to document content (the default) or document metadata properties as returned by the queryBuilder#fragmentScope function
options queryBuilder.RangeOptionsParam <optional>
options from queryBuilder#rangeOptions modifying the default behavior
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

rangeOptions(options) → {queryBuilder.RangeOptionsParam}

Provides options modifying the default behavior of a queryBuilder#range query.
Parameters:
Name Type Argument Description
options string <repeatable>
options supported for range queries
Since:
  • 1.0
Returns:
options for a queryBuilder#range query
Type
queryBuilder.RangeOptionsParam

scope(propertyOrElement, query, fragmentScope) → {queryBuilder.Query}

Builds a query naming a JSON property or XML element that must contain the matches for a subquery (which may be a composer query such as those returned by the queryBuilder#and and queryBuilder#or).
Parameters:
Name Type Argument Description
propertyOrElement string | queryBuilder.IndexedName the JSON property or XML element that contains the query matches; a string is treated as a JSON property
query queryBuilder.Query | queryBuilder.BindingParam either the query that must match within the scope of the JSON property or XML element or a binding (returned by the queryBuilder#bind function) for parsing the subquery from a query string
fragmentScope queryBuilder.FragmentScopeParam <optional>
whether the query applies to document content (the default) or document metadata properties as returned by the queryBuilder#fragmentScope function
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

southWestNorthEast(south, west, north, east) → {object}

Specifies the coordinates of a box as a list of parameters for passing to the queryBuilder#box function or to the queryBuilder#heatmap function
Parameters:
Name Type Description
south queryBuilder.LatLon the south coordinate
west queryBuilder.LatLon the west coordinate
north queryBuilder.LatLon the north coordinate
east queryBuilder.LatLon the east coordinate
Since:
  • 1.0
Returns:
the coordinates for the box
Type
object

temporalOptions(options) → {queryBuilder.TemporalOptionsParam}

Provides options modifying the default behavior of an queryBuilder#lsqtQuery, queryBuilder#periodCompare, or queryBuilder#periodRange query.
Parameters:
Name Type Argument Description
options string <repeatable>
options supported for temporal queries
Since:
  • 1.0
Returns:
options for the temporal query
Type
queryBuilder.TemporalOptionsParam

term(weight, options) → {queryBuilder.Query}

Builds a query for matching words in a JSON, text, or XML document.
Parameters:
Name Type Argument Description
...text string <optional>
one or more words to match
weight queryBuilder.WeightParam <optional>
a weight returned by queryBuilder#weight to increase or decrease the score of the query relative to other queries in the complete search
options queryBuilder.TermOptionsParam <optional>
options from queryBuilder#termOptions modifying the default behavior
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

termOptions(options) → {queryBuilder.TermOptionsParam}

Provides options modifying the default behavior of a queryBuilder#value or queryBuilder#word query.
Parameters:
Name Type Argument Description
options string <repeatable>
options supported for value or word queries
Since:
  • 1.0
Returns:
options for a value or word query
Type
queryBuilder.TermOptionsParam

transform(name, params) → {object}

Specifies a transform for the documents or summary returned by a query or the tuples list returned by a values query. The transform must have been installed previously by the config.transforms#write function
Parameters:
Name Type Argument Description
name string the name of the transform
params object <optional>
the parameters of the transform as key-value pairs
Since:
  • 1.0
Returns:
a transform definition for the queryBuilder#slice function
Type
object

trueQuery() → {queryBuilder.Query}

Builds a query that matches all documents.
Since:
  • 2.0.1
Returns:
a composable query
Type
queryBuilder.Query

udf(pluginName, functionName) → {object}

Identifies a UDF (User Defined Function) that calculates a custom aggregate different from a range index. The plugin implementing the aggregate must have been installed in the database server distribution on all hosts where the database has forests.
Parameters:
Name Type Description
pluginName string the name of the plugin library that implements the UDF
functionName string the name of the function that is the entry point within the library
Since:
  • 1.0
Returns:
the definition of the UDF for passing to the valuesBuilder#aggregates function
Type
object

uri() → {valuesBuilder.DatatypedValuesIndex}

Identifies the uri index as the source for a column of values. Each tuple (aka row) projected from a document includes the uri of the document as one of the columns.
Since:
  • 1.0
Returns:
an identifier for the uri index
Type
valuesBuilder.DatatypedValuesIndex

value(indexedName, binding, defaultBinding, weight, fragmentScope, options) → {queryBuilder.Query}

Builds a query for matching the entire text value contained by a JSON property or XML element. You must supply either one or more text values or a binding to parse the text value from a query string but not both. You can provide both named and default bindings for the same query.
Parameters:
Name Type Argument Description
indexedName string | queryBuilder.IndexedName the JSON property, XML element, field, or path containing the value
...text string <optional>
one or more values to match
binding queryBuilder.BindingParam <optional>
a binding (returned by the queryBuilder#bind function) for parsing the text value from tagged values in a query string
defaultBinding queryBuilder.DefaultBindingParam <optional>
a binding (returned by the queryBuilder#bindDefault function) for parsing the text value from untagged values in a query string
weight queryBuilder.WeightParam <optional>
a weight returned by queryBuilder#weight to increase or decrease the score of the query relative to other queries in the complete search
fragmentScope queryBuilder.FragmentScopeParam <optional>
whether the query applies to document content (the default) or document metadata properties as returned by the queryBuilder#fragmentScope function
options queryBuilder.TermOptionsParam <optional>
options from queryBuilder#termOptions modifying the default behavior
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

weight(modifier) → {queryBuilder.WeightParam}

Increases or decreases the contribution of the query relative to other queries in the result documents ranking.
Parameters:
Name Type Description
modifier number a number between -16 and 64 modifying the contribution of the query to the score
Since:
  • 1.0
Returns:
a query specification for weight
Type
queryBuilder.WeightParam

word(indexedName, binding, defaultBinding, weight, fragmentScope, options) → {queryBuilder.Query}

Builds a query for matching the word contained by a JSON property or XML element. You must supply either one or more words or a binding to parse the words from a query string but not both. You can provide both named and default bindings for the same query.
Parameters:
Name Type Argument Description
indexedName string | queryBuilder.IndexedName the JSON property, XML element, field, or path containing the word
...text string <optional>
one or more words to match
binding queryBuilder.BindingParam <optional>
a binding (returned by the queryBuilder#bind function) for parsing the word from tagged word s in a query string
defaultBinding queryBuilder.DefaultBindingParam <optional>
a binding (returned by the queryBuilder#bindDefault function) for parsing the word from untagged words in a query string
weight queryBuilder.WeightParam <optional>
a weight returned by queryBuilder#weight to increase or decrease the score of the query relative to other queries in the complete search
fragmentScope queryBuilder.FragmentScopeParam <optional>
whether the query applies to document content (the default) or document metadata properties as returned by the queryBuilder#fragmentScope function
options queryBuilder.TermOptionsParam <optional>
options from queryBuilder#termOptions modifying the default behavior
Since:
  • 1.0
Returns:
a composable query
Type
queryBuilder.Query

Type Definitions


DatatypedValuesIndex

A source of datatyped values from a JSON property, XML element or attribute, field, or path range or geospatial index or from the collection or uri index.
Type:
  • object
Since:
  • 1.0
Copyright (c) 2020 MarkLogic Corporation Documentation generated by JSDoc 3.6.4 on 2020-08-04T23:55:51-07:00 using the DocStrap template.