I call the K2SearchNew API with a valid sortSpec, but my results are not sorted. Why?
The K2SearchNew API has a sortSpec input. This input dictates whether the results returned by a search will be sorted or not. The result of this API is also governed by a server flag called vdkSortingFlag. If this flag is set to 0, the results of the search will not be sorted, regardless of the sortSpec. It can specify sorting in the K2 Dashboard by going to the Expert Settings of a server and setting the value for “VDK Field Sorting”. (This server flag can be seen as the vdkSortingFlag attribute of the SERVER in the admin.xml files.) When the flag is set to 1, all the results are sorted based on the input provided in sortSpec. The K2Server takes the top 500 (or the maxDocs value) of these results. In this case, the result obtained from the K2 APIs contains the top 500 (or maxDocs) results based on the sortSpec of all possible results. When the flag is set to 0, the results are sorted by score; thus the K2Server gets the 500 (or maxDocs) most relevant results based on the score. It the