Added option -a to search to dump all the DB. Refactor error handling in search because -a does not takes any args.