IDOL Content Component 12.12

# QuerySort

The method to use to order the initial query results that GetQueryTagValues uses to return tag values.

By default, when you use Combine or MaxResults, the GetQueryTagValues action sorts the query results in reverse order of the document ID. For example, if you set MaxResults to `N`, the action examines `N` documents for query matches, and returns tag values from the matching documents with the highest document IDs.

You can use `QuerySort` to specify a different sort option to determine which tags the action returns. In this case, MaxResults specifies the number of sorted documents to return tag values from.

NOTE: You specify the sort order that the result tag values return in by using the Sort parameter.

You can use the following sort options, which are the same as the Query action Sort parameter:

- `Off`. Do not sort documents.

- `AutnRank`. Sort documents by the value in their AutnRankType field. The document with the highest AutnRankType field value is listed first.

- `Cluster`. Sort documents by decreasing cluster ID. To use this option, you must set Cluster to `True`.

- `Database`. Sort documents by increasing database number. The database numbers are defined in the IDOL Content Component configuration file.

- `Date`. Sort documents by their date (the date contained in the result DateType fields). The most recent document is listed first.

  If several documents have the same date, IDOL Content Component orders them by the `autn:docid` (document ID) number (the highest `autn:docid` is listed first).

- `Distcartesian`. Sort documents according to their distance from a point, specified in Cartesian coordinates (X/Y). When you set XMLMeta to `True`, the action returns the calculated distance in a `<autn:fieldsortvalue>` tag in the response. Use the following format:

      &QuerySort=Distcartesian{coordX,coordY}:POSITION

  where,

  - `coordX` is the specified x coordinate.

  - `coordY` is the specified y coordinate.

  - `POSITION` is either:

    - a single document field that contains the position information in Well-known text format POINT definitions. This field must be a unified GeospatialType field.
    - two fields, in the format `X:Y`, where `X` is the document field that contains the X coordinates, and `Y` is the document field that contains the Y coordinates. These fields must be either GeospatialType or NumericType fields. You must specify the fields in the order X:Y.

  For example:

      &QuerySort=Distcartesian{10,11}:X:Y

  In this example, IDOL Content Component sorts documents according to their distance from the point (10,11). The position of a document in this example is contained in the fields `X` and `Y`, respectively.

- `Distspherical`. Sort documents according to their distance from a point, specified in spherical coordinates (latitude and longitude). When you set XMLMeta to `True`, the action returns the calculated distance in a `<autn:fieldsortvalue>` tag in the response. Use the following format:

      &QuerySort=Distspherical{lat,long}:LOCATION

  where,

  - `lat` is the specified latitude. Specify latitude positions south of the equator as negative.

  - `long` is the specified longitude. Specify longitude positions west of the Greenwich Meridian as negative.

  - `LOCATION` is either:

    - a single document field that contains the location information in Well-known text format POINT definitions. This field must be a unified GeospatialType field.
    - two fields, in the format `Latfield:Longfield`, where `Latfield` is the document field that contains the latitude, and `Longfield` is the document field that contains the longitude. These fields must be either GeospatialType or NumericType fields. You must specify the fields in the order `latitude:longitude`.

For example:

    &QuerySort=Distspherical{37.75,-122.4}:Location

In this example, IDOL Content Component sorts documents according to their distance from San Francisco (37.75N,122.4W). The latitude and longitude position of a document in this example is contained in the `Location` field.

- `DocIDDecreasing`. Sort documents by `autn:docid` (document ID). The document with the highest `autn:docid` is listed first.

- `DocIDIncreasing`. Sort documents by `autn:docid` (document ID). The document with the lowest `autn:docid` is listed first.

- `fieldName:sortMethod`. Sort results according to the value of a specified field.

  NOTE: Documents in which the specified field is empty do not return.

  This sort option is optimized when `fieldName` is a MatchType field.

  - `fieldName`. The name of the IDOL Content Component field to use to determine the document order. You can use fields that you create by using the UserMetaFields parameter.

  - `sortMethod`. The sorting method to apply to the field `fieldName`. The following sorting methods are available:

    `alphabetical` | Sort documents alphabetically by the value of the `fieldName` field. NOTE: IDOL Content Component can perform the sorting process more quickly if `fieldName` is a MatchType field.
    `decreasing` | Sort documents by decreasing order of the value in the `fieldName` field. The result with the highest number, or last in alphabetical order, is listed first. You can sort by the following metadata fields: `<autn_langtype>` `<autn_language>` `<autn_nodesize>` `<autn_refnodesize>` `<autn_distincttermsperdoc>` `<autn_termsperdoc>` NOTE: For NumericType fields, this method is equivalent to `numberdecreasing`. For MatchType fields, this method is equivalent to `reversealphabetical`.
    `increasing` | Sort documents by increasing order of the value in the `fieldName` field. The result with the lowest number, or first in alphabetical order, is listed first. You can sort by the following metadata fields: `<autn_langtype>` `<autn_language>` `<autn_nodesize>` `<autn_refnodesize>` `<autn_distincttermsperdoc>` `<autn_termsperdoc>` NOTE: For NumericType fields, this method is equivalent to `numberincreasing`. For MatchType fields, this method is equivalent to `alphabetical`.
    `numberdecreasing` | Sort documents by decreasing order of the number in the `fieldName` field. NOTE: IDOL Content Component can perform the sorting process more quickly if `fieldName` is a NumericType field.
    `numberincreasing` | Sort documents by increasing order of the number in the `fieldName` field. NOTE: IDOL Content Component can perform the sorting process more quickly if `fieldName` is a NumericType field.
    `reversealphabetical` | Sort documents by the reverse alphabetical order of the value in the `fieldName` field. NOTE: IDOL Content Component can perform the sorting process more quickly if `fieldName` is a MatchType field.

- `Random`. Sort documents randomly.

- `Relevance`. Sort documents by their relevance (the document with the highest relevance is listed first).

  If several documents have the same relevance, IDOL Content Component orders them by the `autn:docid` (document ID) number (the highest `autn:docid` is listed first).

- `ReverseDate`. Sort documents by their date (the date contained in the DateType field). The oldest document is listed first.

  If several documents have the same date, IDOL Content Component orders them by the `autn:docid` (document ID) number (the highest `autn:docid` is listed first).

- `ReverseRelevance`. Sort documents in reverse order of relevance (the document with the lowest relevance is listed first).

  If several documents have the same relevance, IDOL Content Component orders them by the `autn:docid` (document ID) number (the lowest `autn:docid` is listed first).

If you want to sort results by several criteria, specify these criteria in order of precedence, as follows:

    sortOption1+sortOption2+...

NOTE: if you set `Cluster` as one of multiple sorting options, it automatically takes precedence over the other sorting options, regardless of its position in the list.

For example:

    &QuerySort=Relevance+DRETITLE:alphabetical+Date

In this example, results order first by `Relevance`, then alphabetically by `DRETITLE`, and finally by `Date`.

NOTE: You cannot use the `QuerySort` parameter with prediction. If you set Predict to `True` and also set `QuerySort`, IDOL Content Component uses the `QuerySort` and does not use prediction.

Actions: | GetQueryTagValues
Type: | String
Default: | DocIDDecreasing
Example: | `QuerySort=Date`
See Also: | Combine MaxResults Sort UserMetaFields Query action Sort parameter AutnRankType configuration parameter NumericType configuration parameter MatchType configuration parameter SortComparisonMethod configuration parameter

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 2022

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 swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL IDOL Content Component 12.12

Topic Title: QuerySort