Add function to search messages.