Open topic with navigation

# Sort

A JSON array that defines the sort methods to use for the GetResources results.

The array specifies the sort methods in the order to apply them. Answer Server sorts the results according to the first method. If there are any tied results, it sorts them according to the second method, and so on.

Each sort specifier is a JSON object, with one or more of the following properties:

- (Required) sort_by. The resource attribute to sort by. This property accepts the following possible values:

  - id. Sort by the resource ID.
  - created_time. Sort by the creation timestamp of the resource.
  - modified_time. Sort by the last-modified timestamp of the resource.
  - status. Sort by the current status. This option applies to question resources only.
  - metadata. Sort by the value of a metadata field. This option applies to question_equivalence_class resources only. For this option, you must also set metadata_key.
  - popularity. Sort by the value of the usage count field, which stores the number of times that the question equivalence class rule has recently matched against `Ask` actions (for more information, see PopularityWindowDays). This option applies to question_equivalence_class resources only.
  - likelihood. Sort questions by the likelihood that there is an existing answer. To calculate this likelihood, Answer Server uses the question to query your question equivalence classes, and uses the relevance score of each question equivalence class in the query to calculate the likelihood score. This option applies to question resources only.
  - incongruity. Sort question equivalence classes by the number of associated equivalent questions that do not match the question equivalence rule. This option applies to question_equivalence_class resources only.
  - random. Return results in a random order.

- ascending. Whether to sort in ascending order. This is a Boolean property. The default value is true.

- metadata_key. (Required when sort_by is set to metadata) The metadata field to sort by.

- metadata_type. The data type of the metadata values that you want to sort by, when sort_by is set to metadata. This property accepts the following values:

  - auto. Sort by the configured or native data type of the metadata field. This is the default option.
  - text. Sort values alphabetically.
  - numeric. Sort values numerically.

NOTE:

All the properties and options are case sensitive.

To get a full JSON schema for `Sort`, send the GetResources action with Type set to `schema`.

Actions: | GetResources
Type: | String
Default: | all
Example: | `Sort=[{"sort_by":"metadata","metadata_key":"AUTHOR","metadata_type":"text"}]`
See Also: | IDs

© Copyright 2016-2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm