Improve sortBy columns on search

- only add id field to sortBy if columns are non-unique
- mark id column order as DESC when needed
Optimize m2o/o2o data fetch

Fixes RM-2845