Add new configuration key 'format-thread'

This variable albe to configure "by thread" output of list functions
Add search by thread (wip)
Add tests for fetch_uids and fetch_thread functions