Optimizing search result element generation