engine: Fix slow API query for list of templates in a Datacenter

This patch improves the performance of SearcQuery for templates by Datacenter.
It improves performance by about a factor of 5.

Change-Id: I13460ae1aa3d7cb2816ed53b5ca7da64f15b8845
Bug-Url: https://bugzilla.redhat.com/1029106
Signed-off-by: lzelkha@redhat.com <lzelkha@redhat.com>