Range Management

hunterhacker edited this page Dec 16, 2011 · 11 revisions

Range Management

A range allows you to perform queries over a range of values. For example, if you want to fetch all documents where the "published::date" is after 2011-01-01, you would add a range on the "published::date" key.

Create a range

Creates a range in the database. Ranges can not share the same name as fields or mappings, they must be unique.

  • Endpoint: /manage/range/<range-name>
  • Request type: POST
  • Paramaters: (note: must specify either a key, an element or both an element and an attribute)
    • key (optional) - A JSON key to build the range on
    • element (optional) - An XML element to build the range on
    • attribute (optional) - An XML attribute to build the range on. Note: must specify the element that the attribute is on.
    • type - The datatype for the range. Please see supported range datatypes for a list of valid types.
    • collation - The collation to use for string range indexes.
  • Returns:
    • On success a 200 is returned with an empty response body
    • If a range, field or mapping with this name already exists, a 400 is returned
    • If parameters are missing or invalid, a 400 is returned
  • Examples:
    • /manage/range/date?key=published::date&type=date
    • /manage/range/author?element=author_name&type=string
    • /manage/range/author?element=article&attribute=author&type=string

Get a list of all configured ranges

To get a list of all the ranges that are configured, make a GET request to:

/manage/ranges

Get info about a range

Returns information about how a range is configured.

  • Endpoint: /manage/range/<range-name>
  • Request type: GET
  • Returns:
    • If the range exists, a 200 is returned with the response body being a JSON document that describes the range configuration
    • If the range does not exist, a 404 is returned
  • Example:
    • /manage/range/publication-date

Sample Responses

{
    "name": "date",
    "key": "published::date",
    "type": "date"
}

{
    "name": "author",
    "element": "article",
    "attribute": "author",
    "type": "string"
}

Delete a range

Deletes the range.

  • Endpoint: /manage/range/<range-name>
  • Request type: DELETE
  • Returns:
    • If the range was deleted, a 200 is returned with an empty response body.
    • If the range does not exist, a 404 is returned
  • Example:
    • /manage/range/date

Discussion

Add mention that if you have pre-configured range indexes, you can just tell Corona about them here to give them a name but there won't be any required reindexing.

Need to add discussion about what collation names are allowed.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.