Knowledge Discovery 25.3
Knowledge Discovery Expert

# Sort Results

By default, the Content component 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 Content 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 Content must load values individually from disk for each potential result document.

Configuring optimized field types increases the amount of disk space used by the Content 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, Content 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 Content can ignore. For more information, refer to the Content Component Help.

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, Content 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.

Copyright 2025 Open Text
Version 25.3 | Last updated July 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery 25.3

Topic Title: Sort Results