# SolrQuery::addSortField

(PECL solr >= 0.9.2)

SolrQuery::addSortField — Used to control how the results should be sorted

### Description

public SolrQuery::addSortField ( string `$field` [, int `$order` = SolrQuery::ORDER_DESC ] ) : SolrQuery

Used to control how the results should be sorted.

### Parameters

`field`

  The name of the field

`order`

  The sort direction. This should be either SolrQuery::ORDER_ASC or SolrQuery::ORDER_DESC.

### Return Values

Returns the current SolrQuery object.