Sets sort direction on a field value for a content query.
Note: for fields of some field types order will vary per search engine. This comes from the different way of storing IDs in the search backend, and therefore relates to the field types that store ID value for sorting (Relation field type). For Legacy search engine IDs are stored as integers, while with Solr search engine they are stored as strings. In that case the difference will be basically the one between numerical and alphabetical order of sorting.
This reflects API definition of IDs as mixed type (integer or string).
Properties¶
$direction
¶
Sort direction One of Query::SORT_ASC or Query::SORT_DESC;.
|
|
$target
¶
Sort target, high level: section_identifier, attribute_value, etc.
|
|
$targetData
¶
Extra target data, required by some sort clauses, field for instance.
|
|
$customFields
¶
Custom fields to sort by instead of the default field.
|
|
Methods¶
__construct()
¶
Constructs a new Field SortClause on Type $typeIdentifier and Field $fieldIdentifier.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$typeIdentifier | string | - | - |
$fieldIdentifier | string | - | - |
$sortDirection | string | Query::SORT_ASC | - |
getCustomField()
¶
Return custom field.
|
|
If no custom field is set, return null
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$type | string | - | - |
$field | string | - | - |
setCustomField()
¶
Set a custom field to sort by.
|
|
Set a custom field to sort by for a defined field in a defined type.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$type | string | - | - |
$field | string | - | - |
$customField | string | - | - |