Specifying a default record sort order

If an Endeca-enabled Web application does not specify sort order as part of the query, the MDEX Engine returns query results using the default sort order, if one has been specified.

You specify the default sort order and sort direction (ascending or descending) by using the --sort flag when running Dgidx. The --sort flag has the following syntax:

--sort "key|dir"

where key is the name of an Endeca property or dimension on which to sort and dir is either asc for an ascending order or desc for descending (if not specified, the order will be ascending).

You can also specify multiple sort keys in the format:

--sort "key_1|dir_1||key_2|dir_2||...||key_n|dir_n"

If you specify multiple sort keys, the records are sorted by the first sort key, with ties being resolved by the second sort key, whose ties are resolved by the third sort key, and so on.

Note: If you are using the Endeca Application Controller (EAC) to control your environment, you must omit the quotation marks from the --sort flag. Instead, use the following syntax:

If you are using the Endeca Application Controller (EAC) to control your environment, you must omit the quotation marks from the --sort flag. Instead, use the following syntax:

--sort key_1|dir_1||key_2|dir_2||...||key_n|dir_n

Agraph default sort order and displayed record lists

If a default record sort order is specified in Dgidx based on a property which is not set to show in the record list, an Agraph managing the resulting Dgraphs will not consistently display records in the default sort order.

Each child Dgraph displays its own records in the correct order, but the Agraph does not reliably preserve this order when integrating its child record sets. The resulting record order will be close to—but not the same as—the actual specified default sort order.

To prevent this problem, use Developer Studio's Property editor to enable the 'Show with record list' setting for the sort property. This ensures that the Agraph will determine the correct record display order.