extensions
Source: query-builder-extensions.
Methods
Methods
collectionConstraint(name, values) → Object
Builds a collection-constraint-query
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name |
String |
|
constraint name |
values |
(String or Array of String) |
|
the values the constraint should equal (logical OR) |
- Returns
-
Object
collection-constraint-query
combined(query[, qtext][, options]) → Object
Builds a combined query
Parameters
Name | Type | Optional | Description |
---|---|---|---|
query |
Object |
|
a structured query (from MLQueryBuilder#where) |
qtext |
String |
Yes |
a query text string, to be parsed server-side |
options |
Object |
Yes |
search options |
- Returns
-
Object
combined query
constraint(type) → function()
constraint query function factory
Parameter
Name | Type | Optional | Description |
---|---|---|---|
type |
String |
|
constraint type ( |
- Returns
-
function()
a constraint query builder function, one of:- MLQueryBuilder.ext.rangeConstraint
- MLQueryBuilder.ext.valueConstraint
- MLQueryBuilder.ext.wordConstraint
- MLQueryBuilder.ext.collectionConstraint
- MLQueryBuilder.ext.customConstraint
customConstraint(name, values) → Object
Builds a custom-constraint-query
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name |
String |
|
constraint name |
values |
(repeatable String, Array of String, or Array of Object) |
|
the values the constraint should equal (logical OR) |
- Returns
-
Object
custom-constraint-query
geospatialConstraint(name, ...values) → Object
Builds a geospatial-constraint-query
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name |
String |
|
constraint name |
values |
Object |
|
the geospatial values to parse Value can be repeated. |
- Returns
-
Object
geospatial-constraint-query
geospatialValues(...values) → Object
Helper method: builds an object of points
, boxes
, circles
, and polygons
, used by MLQueryBuilder.ext.geospatialConstraint, for use with MLQueryBuilder.ext.customConstraint
examples:
qb.ext.geospatialConstraint('name',
{ latitude: 1, longitude: 2 },
{ south: 1, west: 2, north: 3, east: 4 }
)
qb.ext.customConstraint('name', qb.ext.geospatialValues(
{ latitude: 1, longitude: 2 },
{ south: 1, west: 2, north: 3, east: 4 }
))
Parameter
Name | Type | Optional | Description |
---|---|---|---|
values |
Object |
|
the geospatial values to parse Value can be repeated. |
- Returns
-
Object
parsed geospatial values
operatorState(name, stateName) → Object
Builds an operator-state
query component
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name |
String |
|
operator name |
stateName |
String |
|
operator-state name |
- Returns
rangeConstraint(name[, operator], values[, options]) → Object
Builds a range-constraint-query
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name |
String |
|
constraint name |
operator |
String |
Yes |
operator for matching constraint to |
values |
(String or Array of String) |
|
the values the constraint should equal (logical OR) |
options |
(String or Array of String) |
Yes |
range options: http://docs.marklogic.com/guide/rest-dev/appendixa#id_84264 |
- Returns
-
Object
range-constraint-query
valueConstraint(name, values) → Object
Builds a value-constraint-query
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name |
String |
|
constraint name |
values |
(String, Number, Array of String, Array of Number, or null) |
|
the values the constraint should equal (logical OR) |
- Returns
-
Object
value-constraint-query
wordConstraint(name, values) → Object
Builds a word-constraint-query
Parameters
Name | Type | Optional | Description |
---|---|---|---|
name |
String |
|
constraint name |
values |
(String or Array of String) |
|
the values the constraint should equal (logical OR) |
- Returns
-
Object
word-constraint-query