[#218,refactor,query][m]: refactor query object sort attribute structure as described in #218 - fixes #218.

This commit is contained in:
Rufus Pollock
2012-08-21 23:55:03 +01:00
parent 09ffb04e40
commit 4737d7ecc5
5 changed files with 50 additions and 14 deletions

View File

@@ -193,7 +193,7 @@ Query object has the following key attributes:
* size (=limit): number of results to return
* from (=offset): offset into result set - http://www.elasticsearch.org/guide/reference/api/search/from-size.html
* sort: sort order - <http://www.elasticsearch.org/guide/reference/api/search/sort.html>
* sort: sort order - see below
* query: Query in ES Query DSL <http://www.elasticsearch.org/guide/reference/api/search/query.html>
* filter: See filters and <a href="http://www.elasticsearch.org/guide/reference/query-dsl/filtered-query.html">Filtered Query</a>
* fields: set of fields to return - http://www.elasticsearch.org/guide/reference/api/search/fields.html
@@ -212,6 +212,24 @@ Additions:
* filters: array of ElasticSearch filters. These will be and-ed together for
execution.
#### Sort
Sort structure is inspired by <http://www.elasticsearch.org/guide/reference/api/search/sort.html> but with some standardization.
Sort structure must be as follows:
"sort" : [
{ field: "post_date", "order" : "desc"},
{ field: "user" },
{ "name" : "desc" },
{ "age" : "desc" },
{"_score": null}
]
If order is omitted it is assumed to be "desc" except in the case of _score.
_score is a special case which is used for match score if that is supported by
the backend.
#### Examples
<pre>