Implement a simple matching algorithm for search