5x search result export metadata

https://jira.duraspace.org/browse/DS-1262

Sorry for the previous bad design attempts at this feature. In the future I will test and confirm correctness before submitting pull request. I hope this has minimal mistakes and meets the requirements of the JIRA ticket.
Oh. I often use that to eventually add a global debug variable to enable disable verbose debugging. I will remove it.