implement search with magic (thanks to matt)