narrow results based on query and run _templatesmanagerscript when present