Open topic with navigation

Use Your Content > Inquire > Query > Query Results > Sort Results

# Sort Results

By default, IDOL Server returns results in decreasing relevance order, and then by document ID when the relevance is equal. You can turn sorting off, in which case documents return in reverse document ID order. This is the fastest method. Applying any sort generally slows query processing down because IDOL Server has to evaluate the results more thoroughly.

You can apply sort to metadata values (for example, date, language), values in fields, values calculated from fields (for example DISTSPHERICAL), or a combination.

## Optimized Sort

Sorting is fastest for metadata values and for optimized field types. The SortType, NumericType, NumericDateType, and MatchType field properties are all optimized.

It is possible to sort by a value on a non-optimized field type, but this method should be used sparingly. It can have a high performance impact because IDOL Server must load values individually from disk for each potential result document.

Configuring optimized field types increases the amount of disk space used by the IDOL Server index, with an additional memory increase, unless you restrict the memory by using other configuration settings.

## Performance

If you suspect that sorting is a performance bottleneck in your system, you should check the types of the fields that you are using to sort.

The `XMLMeta` query parameter shows you the sort values that have been used for each result document.

## Improve Sorting

To sort `SortType` fields, IDOL Server examines the first `SortFieldStorageLength` bytes in the sort value. If your documents contain values that do not differ in the first `SortFieldStorageLength` bytes, they might appear to be sorted incorrectly. Increasing this value increases the memory usage, so do this only where necessary. You can also consider using the `SortFieldPrefixCSVs` parameter to specify a prefix to sort values, which IDOL Server can ignore. For more information, refer to the IDOL Server Reference.

If a document is missing the specified sort field, by default it is not included in the results, unless you have configured `SortReturnAllDocuments`. You can alter this behavior further by using the `SortMissingValueAtEnd` configuration parameter.

The best practice for sorting is to sort on fields that can have at most one instance in a document. If a document contains multiple matches for the specified sort field, IDOL Server uses the ‘least’ value as the sort value for an optimized field type, and the first value in the document for a non-optimized field type.

You can modify the sort order for accented or CJK (Chinese, Japanese, and Korean) characters by using the `SortComparisonMethod` configuration parameter.

## Distributed Sort

In a distributed system, the Distributed Action Handler (DAH) passes sort parameters on to the child servers. It expects to get sorted results from each child, and compares the top results for each child to find the top result of the whole set. If your results do not appear to be sorted in the correct order, check that your child servers sort results as expected.

© 2018 Micro Focus or one of its affiliates | Send documentation feedback to Micro Focus 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