sorting of document terms from parameters