getSortedTermIDs

Returns the sorted term IDs. .sortTerms must be called before