Class

OsduQueryBuilder

OsduQueryBuilder()

Class to build OSDU query bodies with friendly names for each available option

  • Note that querys built with this builder must at minimum specify the kind
  • Follows the OSDU Query Syntax
Constructor

# new OsduQueryBuilder()

View Source models/query/osduQueryBuilder.js, line 12

Methods

# aggregateBy(field)

Set the field by which to aggregate results if aggregation is requested

Parameters:
Name Type Description
field string

The OSDU record field by which to aggregate results

View Source models/query/osduQueryBuilder.js, line 115

# build() → {Object}

Construct the query request body based on the attributes set

View Source models/query/osduQueryBuilder.js, line 125

The JSON object that is passed into the body of the OSDU API Search request

Object

# kind(kind)

Set the OSDU kind to filter the scope of the search.

  • Accepts wildcards * within kind sections. (I.E. *:osdu:*:0.2.0)
Parameters:
Name Type Description
kind string

The OSDU kind with which to filter the search

View Source models/query/osduQueryBuilder.js, line 25

# limit(limit)

Set the maximum limit of records to return within the query results

  • In paged queries, this sets the page size
Parameters:
Name Type Description
limit number

The maximum number of records (positive integer) to return

View Source models/query/osduQueryBuilder.js, line 70

# offset(offset)

Set the offset value representing how many records should be skipped before collecting records to return

Parameters:
Name Type Description
offset number

The number of records (positive integer) to skip before collecting records to return

Deprecated:
  • Recommended to use the paged query rather than attempting to page via offset

View Source models/query/osduQueryBuilder.js, line 60

# query(query_expression)

Set the OSDU compliant query expression to narrow the search results

Parameters:
Name Type Description
query_expression OsduQueryExpression

The query expression used to narrow search results based on the available OSDU data

View Source models/query/osduQueryBuilder.js, line 36

# returnedFields(returned_fields)

Set the fields to include on the returned records

  • Will include these fields where found, but does not guarantee that all records will contain these fields
Parameters:
Name Type Description
returned_fields Array.<sring>

View Source models/query/osduQueryBuilder.js, line 80

# sort(fields, order)

Set the sort order of results prior to paging

Parameters:
Name Type Description
fields Array.<string>

The fields by which to order the results

order Array.<string>

The order (Ascending/Descending) in which to sort the results on each field. Only accepts "ASC" and "DESC"

View Source models/query/osduQueryBuilder.js, line 94

# spacialFilter(spacial_filter)

Set the spacial filter on the OSDU query

  • Not yet supported.
Parameters:
Name Type Description
spacial_filter undefined

View Source models/query/osduQueryBuilder.js, line 50

Error