An optimized search engine( sample code )