Fully working search with double cache, with Trie and Output caching.