public class StructuredQueryBuilder extends Object
StructuredQueryBuilder builds a query for documents in the database.
| Modifier and Type | Class and Description |
|---|---|
static interface |
StructuredQueryBuilder.Attribute
An Attribute represents an attribute in database documents.
|
static interface |
StructuredQueryBuilder.Axis
An axis for use in
temporalPeriodRange or temporalPeriodCompare queries. |
static interface |
StructuredQueryBuilder.Box |
static interface |
StructuredQueryBuilder.Circle |
static interface |
StructuredQueryBuilder.ContainerIndex
A ContainerIndex can be used for container queries.
|
static class |
StructuredQueryBuilder.CoordinateSystem
CoordinateSystem provides a list of all known coordinate systems and it also provides a capability to add new CoordinateSystems in the future
|
static interface |
StructuredQueryBuilder.Element
An Element represents an element in database documents.
|
static interface |
StructuredQueryBuilder.ElementAttribute
An ElementAttribute represents an attribute on an element in database documents.
|
static interface |
StructuredQueryBuilder.Field
A Field represents a field defined in the database configuration.
|
static class |
StructuredQueryBuilder.FragmentScope
Whether a query should search the document or its associated properties.
|
static interface |
StructuredQueryBuilder.GeospatialIndex
A GeospatialIndex can be used for geospatial queries.
|
static class |
StructuredQueryBuilder.GeospatialOperator
Geospatial operators to be used in geospatial region index queries
|
static interface |
StructuredQueryBuilder.GeospatialRegionIndex
A GeospatialRangeIndex can be used for geospatial region index queries.
|
static interface |
StructuredQueryBuilder.JSONProperty
A JSONProperty represents a key in JSON database documents.
|
static class |
StructuredQueryBuilder.Operator
A comparison operator for use in range queries.
|
static class |
StructuredQueryBuilder.Ordering
Control over ordering for use in near queries.
|
static interface |
StructuredQueryBuilder.PathIndex
A PathIndex represents an index defined with an XPath in the database configuration.
|
static interface |
StructuredQueryBuilder.Period
A temporal period for use in
temporalPeriodRange queries. |
static interface |
StructuredQueryBuilder.Point |
static interface |
StructuredQueryBuilder.Polygon |
static interface |
StructuredQueryBuilder.RangeIndex
A RangeIndex can be used for range queries.
|
static interface |
StructuredQueryBuilder.Region
A region matched by a geospatial query.
|
static class |
StructuredQueryBuilder.TemporalOperator
The Allen and ISO SQL 2011 temporal operators available for use in
temporalPeriodRange or temporalPeriodCompare queries. |
static interface |
StructuredQueryBuilder.TextIndex
A TextIndex can be used for word and value queries.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
SEARCH_API_NS |
| Constructor and Description |
|---|
StructuredQueryBuilder()
Zero-argument constructor.
|
StructuredQueryBuilder(IterableNamespaceContext namespaces)
Constructs a query builder for queries using the specified namespace bindings.
|
StructuredQueryBuilder(String optionsName)
Constructs a query builder for queries against the options persisted with the specified name.
|
StructuredQueryBuilder(String optionsName,
IterableNamespaceContext namespaces)
Constructs a query builder for queries against the options persisted with the specified name using the specified namespace bindings.
|
| Modifier and Type | Method and Description |
|---|---|
StructuredQueryDefinition |
and(StructuredQueryDefinition... queries)
Defines an AND query over the list of query definitions.
|
StructuredQueryDefinition |
andNot(StructuredQueryDefinition positive,
StructuredQueryDefinition negative)
Defines an AND NOT query combining a positive and negative query.
|
StructuredQueryBuilder.Attribute |
attribute(QName qname)
Identifies a namespaced attribute to match with a query.
|
StructuredQueryBuilder.Attribute |
attribute(String name)
Identifies a simple attribute to match with a query.
|
StructuredQueryBuilder.Axis |
axis(String name)
Identify an axis for use in
temporalPeriodRange or temporalPeriodCompare queries. |
StructuredQueryDefinition |
boost(StructuredQueryDefinition matchingQuery,
StructuredQueryDefinition boostingQuery)
Defines a boost query for the matching and boosting query definitions.
|
StructuredQueryBuilder.Box |
box(double south,
double west,
double north,
double east)
Specifies a geospatial region as a box, supplying the coordinates for the perimeter.
|
RawStructuredQueryDefinition |
build(StructuredQueryDefinition... queries)
Builds a structured query in XML from the list of query definitions.
|
StructuredQueryBuilder.Circle |
circle(double latitude,
double longitude,
double radius)
Specifies a geospatial region as a circle, supplying coordinates for the center.
|
StructuredQueryBuilder.Circle |
circle(StructuredQueryBuilder.Point center,
double radius)
Specifies a geospatial region as a circle, supplying a point for the center.
|
com.marklogic.client.query.StructuredQueryBuilder.CollectionQuery |
collection(String... uris)
Matches documents belonging to at least one of the criteria collections.
|
StructuredQueryDefinition |
collectionConstraint(String constraintName,
String... uris)
Matches documents belonging to at least one of the criteria collections with the specified constraint.
|
StructuredQueryDefinition |
containerConstraint(String constraintName,
StructuredQueryDefinition query)
Matches a query within the substructure of the container specified by the constraint.
|
StructuredQueryDefinition |
containerQuery(StructuredQueryBuilder.ContainerIndex index,
StructuredQueryDefinition query)
Matches a query within the substructure contained by an element or JSON property.
|
com.marklogic.client.query.StructuredQueryBuilder.CustomConstraintQuery |
customConstraint(String constraintName,
String... text)
Matches documents as specified by a constraint that implements a custom query parameterized with the supplied text.
|
com.marklogic.client.query.StructuredQueryBuilder.DirectoryQuery |
directory(boolean isInfinite,
String... uris)
Matches documents at the specified depth within at least one of the criteria directories.
|
com.marklogic.client.query.StructuredQueryBuilder.DirectoryQuery |
directory(int depth,
String... uris)
Matches documents at the specified depth within at least one of the criteria directories.
|
com.marklogic.client.query.StructuredQueryBuilder.DocumentQuery |
document(String... uris)
Matches the specified documents.
|
StructuredQueryDefinition |
documentFragment(StructuredQueryDefinition query)
Associates a query with the content of documents (as opposed to the properties of documents).
|
StructuredQueryBuilder.Element |
element(QName qname)
Identifies a namespaced element to match with a query.
|
StructuredQueryBuilder.Element |
element(String name)
Identifies a simple element to match with a query.
|
StructuredQueryBuilder.ElementAttribute |
elementAttribute(StructuredQueryBuilder.Element element,
StructuredQueryBuilder.Attribute attribute)
Identifies an element having an attribute to match with a query.
|
StructuredQueryBuilder.Field |
field(String name)
Identifies a field to match with a query.
|
StructuredQueryBuilder.GeospatialIndex |
geoAttributePair(StructuredQueryBuilder.Element parent,
StructuredQueryBuilder.Attribute lat,
StructuredQueryBuilder.Attribute lon)
Identifies a parent element with child latitude and longitude attributes to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialIndex |
geoElement(StructuredQueryBuilder.Element element)
Identifies an element whose text has the latitude and longitude coordinates to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialIndex |
geoElement(StructuredQueryBuilder.Element parent,
StructuredQueryBuilder.Element element)
Identifies a parent element with a child element whose text has the latitude and longitude coordinates to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialIndex |
geoElementPair(StructuredQueryBuilder.Element parent,
StructuredQueryBuilder.Element lat,
StructuredQueryBuilder.Element lon)
Identifies a parent element with child latitude and longitude elements to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialIndex |
geoJSONProperty(StructuredQueryBuilder.JSONProperty jsonProperty)
Identifies a json property whose text has the point format latitude and longitude coordinates to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialIndex |
geoJSONProperty(StructuredQueryBuilder.JSONProperty parent,
StructuredQueryBuilder.JSONProperty jsonProperty)
Identifies a parent json property with a child json property whose text has the latitude and longitude coordinates to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialIndex |
geoJSONPropertyPair(StructuredQueryBuilder.JSONProperty parent,
StructuredQueryBuilder.JSONProperty lat,
StructuredQueryBuilder.JSONProperty lon)
Identifies a parent json property with child latitude and longitude json properties to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialIndex |
geoPath(StructuredQueryBuilder.PathIndex pathIndex)
Identifies a path with the latitude and longitude to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialRegionIndex |
geoRegionPath(StructuredQueryBuilder.PathIndex pathIndex)
Identifies a path with regions to match with a geospatial query.
|
StructuredQueryBuilder.GeospatialRegionIndex |
geoRegionPath(StructuredQueryBuilder.PathIndex pathIndex,
StructuredQueryBuilder.CoordinateSystem coordinateSystem)
Identifies a path with regions to match with a geospatial query.
|
StructuredQueryDefinition |
geospatial(StructuredQueryBuilder.GeospatialIndex index,
StructuredQueryBuilder.FragmentScope scope,
String[] options,
StructuredQueryBuilder.Region... regions)
Matches an element, element pair, element attribute, pair, or path specifying a geospatial point that appears within one of the criteria regions.
|
StructuredQueryDefinition |
geospatial(StructuredQueryBuilder.GeospatialIndex index,
StructuredQueryBuilder.Region... regions)
Matches an element, element pair, element attribute, pair, or path specifying a geospatial point that appears within one of the criteria regions.
|
StructuredQueryDefinition |
geospatial(StructuredQueryBuilder.GeospatialRegionIndex index,
StructuredQueryBuilder.GeospatialOperator operator,
StructuredQueryBuilder.FragmentScope scope,
String[] options,
StructuredQueryBuilder.Region... regions)
Matches a path specifying a geospatial region, which is indexed via geospatial region index, that has the relationship given by the operator with at least one of the criteria regions.
|
StructuredQueryDefinition |
geospatial(StructuredQueryBuilder.GeospatialRegionIndex index,
StructuredQueryBuilder.GeospatialOperator operator,
StructuredQueryBuilder.Region... regions)
Matches a path specifying a geospatial region, which is indexed via geospatial region index, that has the relationship given by the operator with at least one of the criteria regions.
|
com.marklogic.client.query.StructuredQueryBuilder.GeospatialConstraintQuery |
geospatialConstraint(String constraintName,
StructuredQueryBuilder.Region... regions)
Matches the container specified by the constraint whose geospatial point appears within one of the criteria regions.
|
StructuredQueryDefinition |
geospatialRegionConstraint(String constraintName,
StructuredQueryBuilder.GeospatialOperator operator,
StructuredQueryBuilder.Region... regions)
Matches the container specified by the constraint whose geospatial region appears within one of the criteria regions.
|
IterableNamespaceContext |
getNamespaces()
Gets the namespace bindings used for the query.
|
StructuredQueryBuilder.JSONProperty |
jsonProperty(String name)
Identifies a JSON property to match with a query.
|
com.marklogic.client.query.StructuredQueryBuilder.LocksQuery |
locks(StructuredQueryDefinition query)
Associates a query with durable locks on documents (as opposed to the content or properties of documents).
|
StructuredQueryDefinition |
near(int distance,
double weight,
StructuredQueryBuilder.Ordering order,
StructuredQueryDefinition... queries)
Defines a NEAR query over the list of query definitions with specified parameters.
|
StructuredQueryDefinition |
near(StructuredQueryDefinition... queries)
Defines a NEAR query over the list of query definitions with default parameters.
|
StructuredQueryDefinition |
not(StructuredQueryDefinition query)
Defines a NOT query for a query definition.
|
StructuredQueryDefinition |
notIn(StructuredQueryDefinition positive,
StructuredQueryDefinition negative)
Defines a not-in query for the positive and negative query definitions.
|
StructuredQueryDefinition |
or(StructuredQueryDefinition... queries)
Defines an OR query over the list of query definitions.
|
StructuredQueryBuilder.PathIndex |
pathIndex(String path)
Identifies a path index to match with a query.
|
StructuredQueryBuilder.Period |
period(Calendar start,
Calendar end)
Construct a temporal period for use in
temporalPeriodRange queries. |
StructuredQueryBuilder.Period |
period(String start,
String end)
Construct a temporal period for use in
temporalPeriodRange queries. |
StructuredQueryBuilder.Point |
point(double latitude,
double longitude)
Specifies a geospatial point.
|
StructuredQueryBuilder.Polygon |
polygon(StructuredQueryBuilder.Point... points)
Specifies a geospatial region as an arbitrary polygon.
|
StructuredQueryDefinition |
properties(StructuredQueryDefinition query)
Associates a query with the properties of documents (as opposed to the content of documents).
|
StructuredQueryDefinition |
propertiesConstraint(String constraintName,
StructuredQueryDefinition query)
Associates a query with the properties of documents (as opposed to the content of documents) with the specified constraint.
|
StructuredQueryDefinition |
range(StructuredQueryBuilder.RangeIndex index,
String type,
String[] options,
StructuredQueryBuilder.Operator operator,
Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
|
StructuredQueryDefinition |
range(StructuredQueryBuilder.RangeIndex index,
String type,
String collation,
String[] options,
StructuredQueryBuilder.Operator operator,
Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
|
StructuredQueryDefinition |
range(StructuredQueryBuilder.RangeIndex index,
String type,
String collation,
StructuredQueryBuilder.FragmentScope scope,
String[] options,
StructuredQueryBuilder.Operator operator,
Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
|
StructuredQueryDefinition |
range(StructuredQueryBuilder.RangeIndex index,
String type,
String collation,
StructuredQueryBuilder.FragmentScope scope,
StructuredQueryBuilder.Operator operator,
Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
|
StructuredQueryDefinition |
range(StructuredQueryBuilder.RangeIndex index,
String type,
String collation,
StructuredQueryBuilder.Operator operator,
Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
|
StructuredQueryDefinition |
range(StructuredQueryBuilder.RangeIndex index,
String type,
StructuredQueryBuilder.Operator operator,
Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
|
StructuredQueryDefinition |
rangeConstraint(String constraintName,
StructuredQueryBuilder.Operator operator,
String... values)
Matches the container specified by the constraint whose value that has the correct datatyped comparison with one of the criteria values.
|
String[] |
rangeOptions(String... options)
Converts the list of options used for a range query to an array as a convenience.
|
void |
setNamespaces(IterableNamespaceContext namespaces)
Specifies the namespace bindings used for the query.
|
StructuredQueryDefinition |
temporalLsqtQuery(String temporalCollection,
Calendar time,
double weight,
String... options)
Matches documents with LSQT prior to timestamp
|
StructuredQueryDefinition |
temporalLsqtQuery(String temporalCollection,
String timestamp,
double weight,
String... options)
Matches documents with LSQT prior to timestamp
|
StructuredQueryDefinition |
temporalPeriodCompare(StructuredQueryBuilder.Axis axis1,
StructuredQueryBuilder.TemporalOperator operator,
StructuredQueryBuilder.Axis axis2,
String... options)
Matches documents that have a relevant pair of period values.
|
StructuredQueryDefinition |
temporalPeriodRange(StructuredQueryBuilder.Axis[] axes,
StructuredQueryBuilder.TemporalOperator operator,
StructuredQueryBuilder.Period[] periods,
String... options)
Matches documents that have a value in the specified axis that matches the specified periods using the specified operator.
|
StructuredQueryDefinition |
temporalPeriodRange(StructuredQueryBuilder.Axis axis,
StructuredQueryBuilder.TemporalOperator operator,
StructuredQueryBuilder.Period period,
String... options)
Matches documents that have a value in the specified axis that matches the specified period using the specified operator.
|
StructuredQueryDefinition |
term(double weight,
String... terms)
Matches documents containing the specified terms, modifying the contribution of the match to the score with the weight.
|
StructuredQueryDefinition |
term(String... terms)
Matches documents containing the specified terms.
|
StructuredQueryDefinition |
value(StructuredQueryBuilder.TextIndex index,
Boolean value)
Matches a JSON property that has a value with the same boolean value as at least one of the criteria values.
|
StructuredQueryDefinition |
value(StructuredQueryBuilder.TextIndex index,
Number... values)
Matches an JSON property that has a value with the same numeric value as at least one of the criteria values.
|
StructuredQueryDefinition |
value(StructuredQueryBuilder.TextIndex index,
String... values)
Matches an element, attribute, JSON property, or field that has a value with the same string value as at least one of the criteria values.
|
StructuredQueryDefinition |
value(StructuredQueryBuilder.TextIndex index,
StructuredQueryBuilder.FragmentScope scope,
String[] options,
double weight,
Boolean value)
Matches a JSON property that has a value with the same boolean value as at least one of the criteria values.
|
StructuredQueryDefinition |
value(StructuredQueryBuilder.TextIndex index,
StructuredQueryBuilder.FragmentScope scope,
String[] options,
double weight,
Number... values)
Matches a JSON property that has a value with the same numeric value as at least one of the criteria values.
|
StructuredQueryDefinition |
value(StructuredQueryBuilder.TextIndex index,
StructuredQueryBuilder.FragmentScope scope,
String[] options,
double weight,
String... values)
Matches an element, attribute, JSON property, or field that has a value with the same string value as at least one of the criteria values.
|
StructuredQueryDefinition |
valueConstraint(String constraintName,
double weight,
String... values)
Matches the container specified by the constraint when it has a value with the same string value as at least one of the criteria values.
|
StructuredQueryDefinition |
valueConstraint(String constraintName,
String... values)
Matches the container specified by the constraint when it has a value with the same string value as at least one of the criteria values.
|
StructuredQueryDefinition |
word(StructuredQueryBuilder.TextIndex index,
String... words)
Matches an element, attribute, JSON property, or field that has at least one of the criteria words.
|
StructuredQueryDefinition |
word(StructuredQueryBuilder.TextIndex index,
StructuredQueryBuilder.FragmentScope scope,
String[] options,
double weight,
String... words)
Matches an element, attribute, JSON property, or field that has at least one of the criteria words.
|
StructuredQueryDefinition |
wordConstraint(String constraintName,
double weight,
String... words)
Matches the container specified by the constraint when it has at least one of the criteria words.
|
StructuredQueryDefinition |
wordConstraint(String constraintName,
String... words)
Matches the container specified by the constraint when it has at least one of the criteria words.
|
public static final String SEARCH_API_NS
public StructuredQueryBuilder()
Zero-argument constructor.
public StructuredQueryBuilder(String optionsName)
Constructs a query builder for queries against the options persisted with the specified name. The query can include constraint queries for any constraints defined by the options.
optionsName - the name of the persisted query optionspublic StructuredQueryBuilder(IterableNamespaceContext namespaces)
Constructs a query builder for queries using the specified namespace bindings.
namespaces - the bindings of prefixes and namespacespublic StructuredQueryBuilder(String optionsName, IterableNamespaceContext namespaces)
Constructs a query builder for queries against the options persisted with the specified name using the specified namespace bindings. The query can include constraint queries for any constraints defined by the options.
optionsName - the name of the persisted query optionsnamespaces - the bindings of prefixes and namespacespublic RawStructuredQueryDefinition build(StructuredQueryDefinition... queries)
Builds a structured query in XML from the list of query definitions. The structured query can be passed to the search() method of QueryManager.
queries - the query definitionspublic StructuredQueryDefinition and(StructuredQueryDefinition... queries)
Defines an AND query over the list of query definitions.
queries - the query definitionspublic StructuredQueryDefinition or(StructuredQueryDefinition... queries)
Defines an OR query over the list of query definitions.
queries - the query definitionspublic StructuredQueryDefinition not(StructuredQueryDefinition query)
Defines a NOT query for a query definition. To negate a list of query definitions, define an AND or OR query over the list and define the NOT query over the AND or OR query.
query - the query definitionpublic StructuredQueryDefinition andNot(StructuredQueryDefinition positive, StructuredQueryDefinition negative)
Defines an AND NOT query combining a positive and negative query. You can use an AND or OR query over a list of query definitions as the positive or negative query.
positive - the positive query definitionnegative - the negative query definitionpublic StructuredQueryDefinition near(StructuredQueryDefinition... queries)
Defines a NEAR query over the list of query definitions with default parameters.
queries - the query definitionspublic StructuredQueryDefinition near(int distance, double weight, StructuredQueryBuilder.Ordering order, StructuredQueryDefinition... queries)
Defines a NEAR query over the list of query definitions with specified parameters.
distance - the proximity for the query termsweight - the weight for the queryorder - the ordering for the query termsqueries - the query definitionspublic StructuredQueryDefinition documentFragment(StructuredQueryDefinition query)
Associates a query with the content of documents (as opposed to the properties of documents).
query - the query definitionpublic StructuredQueryDefinition properties(StructuredQueryDefinition query)
Associates a query with the properties of documents (as opposed to the content of documents).
query - the query definitionpublic com.marklogic.client.query.StructuredQueryBuilder.LocksQuery locks(StructuredQueryDefinition query)
Associates a query with durable locks on documents (as opposed to the content or properties of documents). Such lock fragments are created with xdmp:lock-acquire().
query - the query definitionpublic StructuredQueryDefinition containerQuery(StructuredQueryBuilder.ContainerIndex index, StructuredQueryDefinition query)
Matches a query within the substructure contained by an element or JSON property.
index - the element or JSON propertyquery - the query over the contained substructurepublic com.marklogic.client.query.StructuredQueryBuilder.CollectionQuery collection(String... uris)
Matches documents belonging to at least one of the criteria collections.
uris - the identifiers for the criteria collectionspublic com.marklogic.client.query.StructuredQueryBuilder.DirectoryQuery directory(boolean isInfinite,
String... uris)
Matches documents at the specified depth within at least one of the criteria directories.
isInfinite - true to match a document at any level of depthuris - the identifiers for the criteria directoriespublic com.marklogic.client.query.StructuredQueryBuilder.DirectoryQuery directory(int depth,
String... uris)
Matches documents at the specified depth within at least one of the criteria directories.
depth - specifies how many subdirectories deep to traverse A value of 1 means to exclude subdirectories.uris - the identifiers for the criteria directoriespublic com.marklogic.client.query.StructuredQueryBuilder.DocumentQuery document(String... uris)
Matches the specified documents.
uris - the identifiers for the documentspublic StructuredQueryDefinition term(String... terms)
Matches documents containing the specified terms.
terms - the possible terms to matchpublic StructuredQueryDefinition term(double weight, String... terms)
Matches documents containing the specified terms, modifying the contribution of the match to the score with the weight.
weight - the multiplier for the match in the document rankingterms - the possible terms to matchpublic StructuredQueryDefinition value(StructuredQueryBuilder.TextIndex index, String... values)
Matches an element, attribute, JSON property, or field that has a value with the same string value as at least one of the criteria values.
index - the value containervalues - the possible values to matchpublic StructuredQueryDefinition value(StructuredQueryBuilder.TextIndex index, Boolean value)
Matches a JSON property that has a value with the same boolean value as at least one of the criteria values. Note this method will not match any XML node.
index - the value containervalue - either true or falsepublic StructuredQueryDefinition value(StructuredQueryBuilder.TextIndex index, Number... values)
Matches an JSON property that has a value with the same numeric value as at least one of the criteria values. Note this method will not match any XML node.
index - the value containervalues - the possible values to matchpublic StructuredQueryDefinition value(StructuredQueryBuilder.TextIndex index, StructuredQueryBuilder.FragmentScope scope, String[] options, double weight, String... values)
Matches an element, attribute, JSON property, or field that has a value with the same string value as at least one of the criteria values.
index - the value containerscope - whether the query matches the document content or propertiesoptions - options for fine tuning the queryweight - the multiplier for the match in the document rankingvalues - the possible values to matchpublic StructuredQueryDefinition value(StructuredQueryBuilder.TextIndex index, StructuredQueryBuilder.FragmentScope scope, String[] options, double weight, Boolean value)
Matches a JSON property that has a value with the same boolean value as at least one of the criteria values. Note this method will not match any XML node.
index - the value containerscope - whether the query matches the document content or propertiesoptions - options for fine tuning the queryweight - the multiplier for the match in the document rankingvalue - either true or falsepublic StructuredQueryDefinition value(StructuredQueryBuilder.TextIndex index, StructuredQueryBuilder.FragmentScope scope, String[] options, double weight, Number... values)
Matches a JSON property that has a value with the same numeric value as at least one of the criteria values. Note this method will not match any XML node.
index - the value containerscope - whether the query matches the document content or propertiesoptions - options for fine tuning the queryweight - the multiplier for the match in the document rankingvalues - the possible values to matchpublic StructuredQueryDefinition word(StructuredQueryBuilder.TextIndex index, String... words)
Matches an element, attribute, JSON property, or field that has at least one of the criteria words.
index - the word containerwords - the possible words to matchpublic StructuredQueryDefinition word(StructuredQueryBuilder.TextIndex index, StructuredQueryBuilder.FragmentScope scope, String[] options, double weight, String... words)
Matches an element, attribute, JSON property, or field that has at least one of the criteria words.
index - the word containerscope - whether the query matches the document content or propertiesoptions - options for fine tuning the queryweight - the multiplier for the match in the document rankingwords - the possible words to matchpublic StructuredQueryDefinition range(StructuredQueryBuilder.RangeIndex index, String type, StructuredQueryBuilder.Operator operator, Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
index - the range containertype - the datatype of the container and specified valuesoperator - the comparison with the criteria valuesvalues - the possible datatyped values for the comparisonpublic StructuredQueryDefinition range(StructuredQueryBuilder.RangeIndex index, String type, String collation, StructuredQueryBuilder.Operator operator, Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
index - the range containertype - the datatype of the container and specified valuescollation - the identifier for the strategy for comparing typesoperator - the comparison with the criteria valuesvalues - the possible datatyped values for the comparisonpublic StructuredQueryDefinition range(StructuredQueryBuilder.RangeIndex index, String type, String collation, StructuredQueryBuilder.FragmentScope scope, StructuredQueryBuilder.Operator operator, Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
index - the range containertype - the datatype of the container and specified valuescollation - the identifier for the strategy for comparing typesscope - whether the query matches the document content or propertiesoperator - the comparison with the criteria valuesvalues - the possible datatyped values for the comparisonpublic StructuredQueryDefinition range(StructuredQueryBuilder.RangeIndex index, String type, String[] options, StructuredQueryBuilder.Operator operator, Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
index - the range containertype - the datatype of the container and specified valuesoptions - options for fine tuning the queryoperator - the comparison with the criteria valuesvalues - the possible datatyped values for the comparisonpublic StructuredQueryDefinition range(StructuredQueryBuilder.RangeIndex index, String type, String collation, String[] options, StructuredQueryBuilder.Operator operator, Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
index - the range containertype - the datatype of the container and specified valuescollation - the identifier for the strategy for comparing typesoptions - options for fine tuning the queryoperator - the comparison with the criteria valuesvalues - the possible datatyped values for the comparisonpublic StructuredQueryDefinition range(StructuredQueryBuilder.RangeIndex index, String type, String collation, StructuredQueryBuilder.FragmentScope scope, String[] options, StructuredQueryBuilder.Operator operator, Object... values)
Matches an element, attribute, JSON property, field, or path whose value that has the correct datatyped comparison with one of the criteria values.
index - the range containertype - the datatype of the container and specified valuescollation - the identifier for the strategy for comparing typesscope - whether the query matches the document content or propertiesoptions - options for fine tuning the queryoperator - the comparison with the criteria valuesvalues - the possible datatyped values for the comparisonpublic StructuredQueryDefinition geospatial(StructuredQueryBuilder.GeospatialIndex index, StructuredQueryBuilder.Region... regions)
Matches an element, element pair, element attribute, pair, or path specifying a geospatial point that appears within one of the criteria regions.
index - the container for the coordinates of the geospatial pointregions - the possible regions containing the pointpublic StructuredQueryDefinition geospatial(StructuredQueryBuilder.GeospatialIndex index, StructuredQueryBuilder.FragmentScope scope, String[] options, StructuredQueryBuilder.Region... regions)
Matches an element, element pair, element attribute, pair, or path specifying a geospatial point that appears within one of the criteria regions.
index - the container for the coordinates of the geospatial pointscope - whether the query matches the document content or propertiesoptions - options for fine tuning the queryregions - the possible regions containing the pointpublic StructuredQueryDefinition geospatial(StructuredQueryBuilder.GeospatialRegionIndex index, StructuredQueryBuilder.GeospatialOperator operator, StructuredQueryBuilder.Region... regions)
Matches a path specifying a geospatial region, which is indexed via geospatial region index, that has the relationship given by the operator with at least one of the criteria regions.
index - the container for the geospatial regionsoperator - the geospatial operator to be applied with the regions in the index and the specified regionsregions - the possible regions containing the regionpublic StructuredQueryDefinition geospatial(StructuredQueryBuilder.GeospatialRegionIndex index, StructuredQueryBuilder.GeospatialOperator operator, StructuredQueryBuilder.FragmentScope scope, String[] options, StructuredQueryBuilder.Region... regions)
Matches a path specifying a geospatial region, which is indexed via geospatial region index, that has the relationship given by the operator with at least one of the criteria regions.
index - the container for the geospatial regionsoperator - the geospatial operator to be applied with the regions in the index and the specified regionsscope - whether the query matches the document content or propertiesoptions - options for fine tuning the queryregions - the possible regions containing the regionpublic StructuredQueryBuilder.Element element(QName qname)
Identifies a namespaced element to match with a query.
qname - the name of the elementpublic StructuredQueryBuilder.Element element(String name)
Identifies a simple element to match with a query.
name - the name of the elementpublic StructuredQueryBuilder.Attribute attribute(QName qname)
Identifies a namespaced attribute to match with a query.
qname - the name of the attributepublic StructuredQueryBuilder.Attribute attribute(String name)
Identifies a simple attribute to match with a query.
name - the name of the attributepublic StructuredQueryBuilder.ElementAttribute elementAttribute(StructuredQueryBuilder.Element element, StructuredQueryBuilder.Attribute attribute)
Identifies an element having an attribute to match with a query.
element - the element identifierattribute - the attribute identifierpublic StructuredQueryBuilder.Field field(String name)
Identifies a field to match with a query. Fields are defined in the configuration for the database.
name - the name of the fieldpublic StructuredQueryBuilder.JSONProperty jsonProperty(String name)
Identifies a JSON property to match with a query.
name - the name of the JSON propertypublic StructuredQueryBuilder.PathIndex pathIndex(String path)
Identifies a path index to match with a query.
path - the indexed pathpublic StructuredQueryBuilder.GeospatialIndex geoJSONProperty(StructuredQueryBuilder.JSONProperty jsonProperty)
Identifies a json property whose text has the point format latitude and longitude coordinates to match with a geospatial query.
jsonProperty - the json property containing the geospatial coordinatespublic StructuredQueryBuilder.GeospatialIndex geoJSONProperty(StructuredQueryBuilder.JSONProperty parent, StructuredQueryBuilder.JSONProperty jsonProperty)
Identifies a parent json property with a child json property whose text has the latitude and longitude coordinates to match with a geospatial query.
parent - the parent of the json property with the coordinatesjsonProperty - the json property containing the geospatial coordinatespublic StructuredQueryBuilder.GeospatialIndex geoJSONPropertyPair(StructuredQueryBuilder.JSONProperty parent, StructuredQueryBuilder.JSONProperty lat, StructuredQueryBuilder.JSONProperty lon)
Identifies a parent json property with child latitude and longitude json properties to match with a geospatial query.
parent - the parent json property of lat and lonlat - the json property with the latitude coordinatelon - the json property with the longitude coordinatepublic StructuredQueryBuilder.GeospatialIndex geoElement(StructuredQueryBuilder.Element element)
Identifies an element whose text has the latitude and longitude coordinates to match with a geospatial query.
element - the element containing the geospatial coordinatespublic StructuredQueryBuilder.GeospatialIndex geoElement(StructuredQueryBuilder.Element parent, StructuredQueryBuilder.Element element)
Identifies a parent element with a child element whose text has the latitude and longitude coordinates to match with a geospatial query.
parent - the parent of the element with the coordinateselement - the element containing the geospatial coordinatespublic StructuredQueryBuilder.GeospatialIndex geoElementPair(StructuredQueryBuilder.Element parent, StructuredQueryBuilder.Element lat, StructuredQueryBuilder.Element lon)
Identifies a parent element with child latitude and longitude elements to match with a geospatial query.
parent - the parent of the element with the coordinateslat - the element with the latitude coordinatelon - the element with the longitude coordinatepublic StructuredQueryBuilder.GeospatialIndex geoAttributePair(StructuredQueryBuilder.Element parent, StructuredQueryBuilder.Attribute lat, StructuredQueryBuilder.Attribute lon)
Identifies a parent element with child latitude and longitude attributes to match with a geospatial query.
parent - the parent of the element with the coordinateslat - the attribute with the latitude coordinatelon - the attribute with the longitude coordinatepublic StructuredQueryBuilder.GeospatialIndex geoPath(StructuredQueryBuilder.PathIndex pathIndex)
Identifies a path with the latitude and longitude to match with a geospatial query.
pathIndex - the indexed pathpublic StructuredQueryBuilder.GeospatialRegionIndex geoRegionPath(StructuredQueryBuilder.PathIndex pathIndex)
Identifies a path with regions to match with a geospatial query.
pathIndex - the indexed pathpublic StructuredQueryBuilder.GeospatialRegionIndex geoRegionPath(StructuredQueryBuilder.PathIndex pathIndex, StructuredQueryBuilder.CoordinateSystem coordinateSystem)
Identifies a path with regions to match with a geospatial query.
pathIndex - the indexed pathcoordinateSystem - the coordinate system used along with precision info used for the indexpublic StructuredQueryBuilder.Point point(double latitude, double longitude)
Specifies a geospatial point.
latitude - the latitude coordinatelongitude - the longitude coordinatepublic StructuredQueryBuilder.Circle circle(double latitude, double longitude, double radius)
Specifies a geospatial region as a circle, supplying coordinates for the center.
latitude - the latitude coordinate of the centerlongitude - the longitude coordinate of the centerradius - the radius of the circlepublic StructuredQueryBuilder.Circle circle(StructuredQueryBuilder.Point center, double radius)
Specifies a geospatial region as a circle, supplying a point for the center.
center - the point defining the centerradius - the radius of the circlepublic StructuredQueryBuilder.Box box(double south, double west, double north, double east)
Specifies a geospatial region as a box, supplying the coordinates for the perimeter.
south - the latitude of the south coordinatewest - the longitude of the west coordinatenorth - the latitude of the north coordinateeast - the longitude of the east coordinatepublic StructuredQueryBuilder.Polygon polygon(StructuredQueryBuilder.Point... points)
Specifies a geospatial region as an arbitrary polygon.
points - the list of points defining the perimeter of the regionpublic StructuredQueryDefinition containerConstraint(String constraintName, StructuredQueryDefinition query)
Matches a query within the substructure of the container specified by the constraint.
constraintName - the constraint definitionquery - the query definitionpublic StructuredQueryDefinition propertiesConstraint(String constraintName, StructuredQueryDefinition query)
Associates a query with the properties of documents (as opposed to the content of documents) with the specified constraint.
constraintName - the constraint definitionquery - the query definitionpublic StructuredQueryDefinition collectionConstraint(String constraintName, String... uris)
Matches documents belonging to at least one of the criteria collections with the specified constraint.
constraintName - the constraint definitionuris - the identifiers for the criteria collectionspublic StructuredQueryDefinition valueConstraint(String constraintName, String... values)
Matches the container specified by the constraint when it has a value with the same string value as at least one of the criteria values.
constraintName - the constraint definitionvalues - the possible values to matchpublic StructuredQueryDefinition valueConstraint(String constraintName, double weight, String... values)
Matches the container specified by the constraint when it has a value with the same string value as at least one of the criteria values.
constraintName - the constraint definitionweight - the multiplier for the match in the document rankingvalues - the possible values to matchpublic StructuredQueryDefinition wordConstraint(String constraintName, String... words)
Matches the container specified by the constraint when it has at least one of the criteria words.
constraintName - the constraint definitionwords - the possible words to matchpublic StructuredQueryDefinition wordConstraint(String constraintName, double weight, String... words)
Matches the container specified by the constraint when it has at least one of the criteria words.
constraintName - the constraint definitionweight - the multiplier for the match in the document rankingwords - the possible words to matchpublic StructuredQueryDefinition rangeConstraint(String constraintName, StructuredQueryBuilder.Operator operator, String... values)
Matches the container specified by the constraint whose value that has the correct datatyped comparison with one of the criteria values.
constraintName - the constraint definitionoperator - the comparison with the criteria valuesvalues - the possible datatyped values for the comparisonpublic com.marklogic.client.query.StructuredQueryBuilder.GeospatialConstraintQuery geospatialConstraint(String constraintName, StructuredQueryBuilder.Region... regions)
Matches the container specified by the constraint whose geospatial point appears within one of the criteria regions.
constraintName - the constraint definitionregions - the possible regions containing the pointpublic StructuredQueryDefinition geospatialRegionConstraint(String constraintName, StructuredQueryBuilder.GeospatialOperator operator, StructuredQueryBuilder.Region... regions)
Matches the container specified by the constraint whose geospatial region appears within one of the criteria regions.
constraintName - the constraint definitionoperator - the geospatial operator to be applied with the regions in the index and the criteria regionsregions - the possible regions containing the pointpublic com.marklogic.client.query.StructuredQueryBuilder.CustomConstraintQuery customConstraint(String constraintName, String... text)
Matches documents as specified by a constraint that implements a custom query parameterized with the supplied text.
constraintName - the constraint definitiontext - the input to the custom querypublic String[] rangeOptions(String... options)
Converts the list of options used for a range query to an array as a convenience.
options - the list of range query optionspublic StructuredQueryDefinition boost(StructuredQueryDefinition matchingQuery, StructuredQueryDefinition boostingQuery)
Defines a boost query for the matching and boosting query definitions. The matching or boosting query definitions can each be an AND or OR query definition for complex combinations of criteria.
matchingQuery - the query definition that filters documentsboostingQuery - the query definition that increases the rank for some filtered documentspublic StructuredQueryDefinition notIn(StructuredQueryDefinition positive, StructuredQueryDefinition negative)
Defines a not-in query for the positive and negative query definitions. These query definitions can each be an AND or OR query definition for complex combinations of criteria.
positive - the query definition that includes documentsnegative - the query definition that excludes documentspublic IterableNamespaceContext getNamespaces()
Gets the namespace bindings used for the query.
public void setNamespaces(IterableNamespaceContext namespaces)
Specifies the namespace bindings used for the query. You can use the EditableNamespaceContext class to instantiate a set of bindings between namespace prefixes and Uris.
namespaces - the namespace bindingspublic StructuredQueryBuilder.Axis axis(String name)
Identify an axis for use in temporalPeriodRange or temporalPeriodCompare queries.
name - the name of the axis as configured in the serverpublic StructuredQueryBuilder.Period period(Calendar start, Calendar end)
Construct a temporal period for use in temporalPeriodRange queries.
start - the start date/time for this periodend - the end date/time for this periodpublic StructuredQueryBuilder.Period period(String start, String end)
Construct a temporal period for use in temporalPeriodRange queries.
start - the start date/time for this period, in ISO 8601 formatend - the end date/time for this period, in ISO 8601 formatpublic StructuredQueryDefinition temporalPeriodRange(StructuredQueryBuilder.Axis axis, StructuredQueryBuilder.TemporalOperator operator, StructuredQueryBuilder.Period period, String... options)
Matches documents that have a value in the specified axis that matches the specified period using the specified operator.
axis - the axis of document temporal values used to determine which documents have values that match this queryoperator - the operator used to determine if values in the axis match the specified periodperiod - the period considered using the operatoroptions - string options from the list for cts:period-range-query callspublic StructuredQueryDefinition temporalPeriodRange(StructuredQueryBuilder.Axis[] axes, StructuredQueryBuilder.TemporalOperator operator, StructuredQueryBuilder.Period[] periods, String... options)
Matches documents that have a value in the specified axis that matches the specified periods using the specified operator.
axes - the set of axes of document temporal values used to determine which documents have values that match this queryoperator - the operator used to determine if values in the axis match the specified periodperiods - the periods considered using the operator. When multiple periods are specified, the query matches if a value matches any period.options - string options from the list for cts:period-range-query callspublic StructuredQueryDefinition temporalPeriodCompare(StructuredQueryBuilder.Axis axis1, StructuredQueryBuilder.TemporalOperator operator, StructuredQueryBuilder.Axis axis2, String... options)
Matches documents that have a relevant pair of period values. Values from axis1 must match values from axis2 using the specified operator.
axis1 - the first axis of document temporal values values that match this queryoperator - the operator used to determine if values in the axis match the specified periodaxis2 - the second axis of document temporal valuesoptions - string options from the list for cts:period-compare-query callspublic StructuredQueryDefinition temporalLsqtQuery(String temporalCollection, Calendar time, double weight, String... options)
Matches documents with LSQT prior to timestamp
temporalCollection - the temporal collection to querytime - documents with lsqt equal to or prior to this timestamp will matchweight - the weight for for this queryoptions - string options from the list for cts:lsqt-query callspublic StructuredQueryDefinition temporalLsqtQuery(String temporalCollection, String timestamp, double weight, String... options)
Matches documents with LSQT prior to timestamp
temporalCollection - the temporal collection to querytimestamp - timestamp in ISO 8601 format - documents with lsqt equal to or prior to this timestamp will matchweight - the weight for for this queryoptions - string options from the list for cts:lsqt-query callsCopyright © 2013-2017 MarkLogic Corporation.