Skip to content

Order Parameter (Spider)

JoeWinter edited this page Dec 16, 2014 · 3 revisions

[Table of Contents](https://github.com/dell-oss/Doradus/wiki/Spider Databases: Table-of-Contents) | Previous | Next
Spider Object Queries: Order Parameter


The order parameter sorts the perspective objects by one or more fields. In the simplest case, a scalar field belonging to the perspective table is chosen. Example:
GET /Email/Message/_query?q=Tags=Customer&range=0&o=Size

This sorts selected messages by Size in ascending order. The suffix ASC can be added after the sort field to explicitly request ascending order. Alternatively, the suffice DESC can be added to request descending sort order:

GET /Email/Message/_query?q=Tags=Customer&range=0&o=Size+DESC

If a sort field is MV, the smallest (ascending) or largest (descending) value for each object is chosen to decide the object's sort position.

The order parameter can also use multiple sort fields, as in this example:

GET /Email/Person/_query?q=Department:support&range=0&o=LastName,FirstName+DESC

This query sorts selected people by ascending LastName and then by descending FirstName.

A sort field can also belong to an object linked to the perspective table. When an extended field is used for sorting, the same field should also be requested in the query's field list. Example:

GET /Email/Message/_query?q=NOT Sender.Person.Name IS NULL&range=0  
&o=Sender.Person.Name&f=Sender.Person.Name

This query returns all messages where Sender.Person.Name is not null, sorted by the sender's name, which is also returned.

Clone this wiki locally