Implemented the search function

Implemented the search function. This search will be slow when there is a lot of messages. But it is better than throwing an "not yet implemented" exception.