Fix undefined variables in search result template