internal document span matches are now sorted and unique
resorting to TImSort since it is faster for the general case