Use function to search for whether there is a sortnode or not.
SortIndex: move inspection of IndexRangeNode into functions.
Parser: when throwing parse exceptions add the query and a pointer to the actual indicated error to the message.